Skip to content
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

2.1.0.1000 on Windows 11 hangs Windows Explorer in single thread mode #1207

Closed
4 of 5 tasks
dswiss-desktop-app opened this issue Apr 11, 2024 · 2 comments
Closed
4 of 5 tasks

Comments

@dswiss-desktop-app
Copy link

dswiss-desktop-app commented Apr 11, 2024

Environment

  • Windows version: Windows 11
  • Processor architecture: x64
  • Dokany version: 2.1.0.1000
  • Library type (Dokany/FUSE): Dokan mirror

Check List

  • I checked my issue doesn't exist yet
  • My issue is valid with mirror default sample and not specific to my user-mode driver implementation
  • I can always reproduce the issue with the provided description below.
  • I have updated Dokany to the latest version and have reboot my computer after.
  • I tested one of the last snapshot from appveyor CI

Description

Dokan mirror hangs Windows Explorer (or crashes it) if the following conditions are met:

  • single thread mode (-t)
  • the source folder has a few images, I used .png files
  • Windows Explorer is opened in the mount folder with icons shown and the Details Pane on

If you quickly click through the images, Explorer will hang for several seconds, sometimes indefinitely or crash. When hanging - the system restart may also hang and you need to use the force restart with the power button.

We have experienced the same problem with our app on Windows 11, the app starts Dokan 2.0.4 in single threaded mode. Today I built the dokan mirror example from master (using Visual Studio 2022) and with the -t option I can reproduce the bug very easily, see the video attached.

Parameters used:
mirror.exe -t -l "c:\Users\macie\Desktop\Dokan mirror" -r "c:\Users\macie\test"

Screen Recording (4-11-2024 1-32-03 PM).zip

@dswiss-desktop-app dswiss-desktop-app changed the title 2.1.0.1000 hangs Windows Explorer in single thread mode 2.1.0.1000 on Windows 11 hangs Windows Explorer in single thread mode Apr 11, 2024
@Liryna
Copy link
Member

Liryna commented Apr 11, 2024

Hi @dswiss-desktop-app ,

Thanks for the report but unfortunately this is a known issue (not exactly this case but expected)
https://github.com/dokan-dev/dokany/blob/master/dokan/dokan.h#L147

The usual scenario is that a new request B holds a lock on a file (asked by the system) while a request A tries to complete but it cannot as locking is required. B cannot execute because the thread is busy with A.
On a multiple thread mode, A would unlock when B would have been completed.

I highly suggest not to run in a single thread mode.

A workaround would be to have a pool of thread in the library that takes care of submitting the result to the kernel instead of the single thread. This will allow B to execute on the single thread while another thread is pending for A result submission to go through. This requires some work if anyone is interested to contribute I would be happy to review it.

@dswiss-desktop-app
Copy link
Author

Ok, we need to do a few changes to make our wrapper thread safe. But thanks for the explanation. Unfortunately our team has been downsized and we have no capacity to help you with this... ;-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants