-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mounting more than 64 shares with 1 C# process not possible. #364
Comments
I have the same problem. |
Hi @JFra-AME , Thanks for reporting this! From your logs all the mount succeeded. Could you add a line that tries to list the root folder after the mount ? This should output some debug logs and see which request is failing. |
Hi @Liryna, Thank you for the quick response! I updated the code as shown below and observed the following results: // Run async so that the loop keeps looping but the share does not close down.
_ = Task.Run(async () =>
{
using (var dokanInstance = dokanBuilder.Build(mirror))
using (var notify = new Notify(mirrorPath, actualMountPath, dokanInstance))
{
// Debug message
dokanLogger.Warn($"Is dokany running for:{actualMountPath}. Answer: {dokanInstance.IsFileSystemRunning()}");
// Put in a delay to make sure the drive is mounted before asking for its contents
await Task.Delay(500);
try
{
// Attempt to look into the mounted share and provide the root folder
var files = Directory.EnumerateFileSystemEntries(actualMountPath);
dokanLogger.Warn($"Contents of {actualMountPath}: {string.Join(", ", files)}");
}
catch (Exception ex)
{
dokanLogger.Error($"Failed to list contents of {actualMountPath}: {ex.Message}");
}
await dokanInstance.WaitForFileSystemClosedAsync(uint.MaxValue);
}
}); Folder structureFor this test I used the following folder structure: DebugViewDokany logs(Only the last ones should be interesting) FindingsThe same error returned by File Explorer, "Parameter is incorrect," is thrown when attempting to open the directory in the code. |
I've done a bit more investigation, and it turns out this bug doesn't occur when enabling single-thread. var dokanBuilder = new DokanInstanceBuilder(dokan)
.ConfigureLogger(() => dokanLogger)
.ConfigureOptions(options =>
{
options.Options = DokanOptions.DebugMode | DokanOptions.StderrOutput;
options.MountPoint = actualMountPath;
options.SingleThread = true;
}); However, this is not a viable solution, but it is something interesting I discovered. Dokany is noticeably slower, and occasional exceptions can be observed. |
I believe the limit is on the NTFS side which has a limit of number of reparse point (which is used by dokan to mount in the folder).
To confirm this you could in the same instance of the process use a different NTFS drive to mount the shares folders after number 60 for example |
Environment
Check List
Description
Background
I am using the Dokany .NET wrapper to provide users within my organization with their own virtual drives, each equipped with custom access control. This setup requires the creation of over 64 individual shares, as each user is assigned a unique share.
Problem
When attempting to create multiple shares for users, I encountered a hard limit of 64 shares per C# process. This restriction causes issues when mounting more than 64 shares in a directory such as C:\shares.
Specifically:
Shares exceeding the 64-share "limit" become inaccessible. When trying to access shares 65 and beyond, the system displays an error message: "The parameter is incorrect."
Discrepancy in displayed size: Successfully mounted shares correctly reflect the size of the C: disk. However, shares beyond the limit (those that are "corrupt") show a default or incorrect size:
This behaviour prevents me from scaling the virtual drive solution to meet the needs of the organization.
Replication
To replicate this I provide an altered code of the Mirror .NET sample.
In the class Program of the sample DokanNetMirror
Once this code is running it will take 64 seconds till it will make the "corrupt" shares.
More details
Multible processes
I have also tested running multiple processes, which appears to work, but still remains limited to only 64 shares per process. While this approach offers some benefits, my goal is to enable the creation of more than 64 shares within a single process.
Logs
DebugView kernel logs.
DokanyDebugLogs1.txt
The text was updated successfully, but these errors were encountered: