-
-
Notifications
You must be signed in to change notification settings - Fork 573
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
Deadlock while closing the window with persistent threads running on Windows (again) #1439
Comments
Do you happen to have a standalone example that would reproduce the bug? |
Yes, here you go: https://github.com/gitillusion09/pywebview-test It is a basic (very basic) example but you got the idea. I took as reference your Serverless example, and tweaked it a bit to reproduce the bug: just launch it, the thread will start printing current date on the UI. When closing the app (with the window's cross), the app hangs on forever, even though I terminate the thread from the on_closing() method. Thanks a lot for your time |
@r0x0r It seems to me that the following line |
I modified event handler logic so that instead of launching a thread that is blocked via a semaphore, it executes event handlers synchronously. The fix concerns only the closing event. This fixes the problem in your example. The fix could be found in the master branch. Another fix would be making your background thread daemon and getting rid of the join. |
Thanks a lot for your fix ! Appreciate it :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The message to post on the issue when closing it. If none provided, will not comment when closing an issue. |
Hello @r0x0r :)
When closing, the app keeps hanging forever.
I know there was already a similar issue back in 2017 (#138), but I think the fix does not work (anymore ?) on Windows 11.
I work with pywebview 5.1. I have a renderer thread that in some cases, calls the evaluate_js method periodically. If the application closes at this exact moment, and even though the thread has been joined, the app keeps hanging forever.
Does anyone have the issue on Windows?
I am not sure to have the skills to work on this issue myself...
The text was updated successfully, but these errors were encountered: