The Parallels Shared Folder (\\psf\Home directory) becomes inaccessible to the guest OS (Windows 11) when more than 4032 files have been opened. When the files are closed the directory becomes accessible again. This is an issue when running certain tools in that directory (i.e. running a Visual Studio project).
You can recreate the issue by running this Powershell script somewhere in the \\psf directory:
Code:
Write-Host "Creating tmp folder (and removing old if exists)"
$tmpFolder = "$(Get-Location)\tmpFolder"
Remove-Item -Path $tmpFolder -Recurse -Force -ErrorAction SilentlyContinue
New-Item -Path $tmpFolder -ItemType Directory -Force
$testCnt = 10000
Write-Host "Opening up to $testCnt simultaneous file streams..."
$i = 0
$fsList = @(0) * $testCnt
while ($currCnt -lt $testCnt) {
Write-Host "Opening #$i"
$fsList[$i] = [System.IO.File]::Open("$tmpFolder\$i.test", [System.IO.FileMode]::OpenOrCreate)
if ($?) {
$i += 1
} else {
break
}
}
Write-Host -NoNewLine '\\psf is unavailable, press Enter to clear files...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
Write-Host "Cleaning up file streams..."
for ($j = 0; $j -lt $i; $j++) {
$fsList[$j].Close()
}
Write-Host "\\psf is now available again"
When file #4032 is opened, the OS starts to throw ENOENT errors on any new file accesses. You can verify this by trying to open the \\psf directory from File Explorer while the script is paused with the files open. After you press enter the script will clear all the open file handles, and you'll be able to access the folder again.
Is there a way to increase this limit, ideally to the C runtime limit of 8192 open files? If not, is there a way to change it so that the more fitting EMFILE error is thrown, rather than ENOENT?
Thanks!