-
Notifications
You must be signed in to change notification settings - Fork 671
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
Notepad.exe (memory mapped files) causes ReadFile after Cleanup on same context #1016
Comments
Hi @Dwedit , This is expected. See last line of |
I completely missed that part of the documentation, because I was only reading the comments for the DOKAN_OPERATIONS struct. I didn't realize there was other documentation as well. Here is the line from the documentation in question:
The comments for Another note from the documentation describes the lifetime of the Context:
But a comment in
This suggests that the lifetime of the Context ends in I think it would also help if the documentation made it clear that |
I agree the documentation could be improved regarding this. Just, what do you mean by Cleanup is a blocking operation? |
I meant that the Application calls Meanwhile, the application does not wait |
@Dwedit Oh yes that way indeed. Thanks for sharing your thoughts. |
Which makes me wonder...
|
Windows is properly doing its accounting. Dokan's It's just that here, Dokan's Currently, a call to Dokan However, this can cause a race condition. The application will release the file mapping, and there will not be any blocking calls made to Dokan What should ideally happen:
If there is a technical reason why a blocking
While this could eliminate the need to reanimate files, this would add a filename list check (list is normally empty, checking list size can be lock-free), and possible critical section lock to every single Dokan operation. |
How exactly a dokanlet would do it? Basically this says that every dokanlet has to:
It is not a simplest task. When you say "Windows is properly doing its accounting." you mean Microsoft already managed to "do it right" and iron out unobvious bugs. Now every dokanlet is expected to do it too (while the whole premise of Dokany is to do difficult things once and let "regular" programmers "have it easy" doing dokanlets? Okay, let's assume dokanlets would do. Then it would make dokanlets totalyl independent of Dokan core on the "accounting" part. So, basically that is the road for dokanlets to ignore Dokany's service and reimplementing them on their own. As an option, some eager dokanlet might implement it, but with the goal to iron it out and then "uplift" the implementation into Dokany core, replacing current implementation. Basically making such a dokanlet an "alpha of Dokany" :-) |
Environment
Check List
Description
Notepad.exe is making this sequence of Win32 API calls:
This sequence causes the Dokan Filesystem to see
ReadFile
get called on the same context afterCleanup
has been called.Cleanup
was called as soon as the application calledCloseHandle
on the file handle, even though the file handle had been passed into a FileMapping object, then that FileMapping was passed into a View Of File.Cleanup
should not have happened until the File Mapping and View Of File were both closed.Note that it may possibly be necessary to disable antivirus to reproduce this
Logs
No logs included yet, I don't think they're necessary for this issue.
The text was updated successfully, but these errors were encountered: