-
-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leaked semaphore object warning (#4132)
This pull request fixes #4131: a "leaked semaphore object" warning appears when aborting with CTRL-C in certain configurations. Semaphores are used internally in `multiprocessing.Queue` which never get cleaned up properly. ### Scenario 1: pressing CTRL-C in an FastAPI `app` stared via uvicron from the command line with auto-reloading Because the `multiprocessing.Queue` objects in `native.py` have been created globally they where also instantiated when not in native mode. This PR fixes this by only creating the objects when native mode is activated. ### Scenario 2: pressing CTRL-C when using `ui.run(native=True, reload=True)` This is still unsolved. I verified that the shutdown/cleanup function for the Queue objects are correct. But the it seems that the pywebview window produces also leaked semaphores when pressing CTRL-C. --------- Co-authored-by: Falko Schindler <falko@zauberzeug.com>
- Loading branch information
1 parent
98fd634
commit c202f3e
Showing
3 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
from .native import WindowProxy, method_queue, response_queue | ||
from .native import WindowProxy, create_queues, method_queue, remove_queues, response_queue | ||
from .native_config import NativeConfig | ||
from .native_mode import activate, find_open_port | ||
|
||
__all__ = [ | ||
'NativeConfig', | ||
'WindowProxy', | ||
'activate', | ||
'create_queues', | ||
'find_open_port', | ||
'method_queue', | ||
'remove_queues', | ||
'response_queue', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters