-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-38323: Change MultiLoopChildWatcher to install handlers for all the event loops #26574
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
Conversation
Please remove the |
Ok |
I'm not sure that this issue solves MultiLoopChildWatcher design issue. The MultiLoopChildWatcher doc says that it can be used even if no event loop runs in the main thread, whereas add_signal_handler() must be called from the main thread: https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.loop.add_signal_handler |
This PR changes MultiLoopChildWatcher in a way that it still doesn't require a running loop in the main thread. So the basic idea remains the same. The only change is that MultiLoopChildWatcher now can't be used from any other thread. I've tested it in the REPL and also the test ran for about 30 minutes, so I guess this patch works? |
Breaking backwards compatibility is not an option for 3.9. I'd say the same for 3.10, since we're past feature freeze; beta phase is all about fixing regressions (and potentially ripping out newly introduced features). |
For 3.9, I agree. But since this is a bug wouldn't it be better to fix it in 3.10 beta? |
IMO, it's better to deprecate the class in 3.10 and remove it in 3.12, and for 3.9 do nothing. But, like Victor, I'm not an asyncio user, nor do I have any knowledge of that module, so my opinion does not really matter here. |
This PR is stale because it has been open for 30 days with no activity. |
|
Fix a race condition in
MultiLoopChildWatcher
. This patch does the following -MultiLoopChildWatcher
.attach_loop
andadd_child_handler
, the handler is installed for the loop usingadd_signal_handler
and the event loop instance is also added to the list.remove_child_handler
, theremove_signal_handler
is called on the loop the provided pid is attached to.close
, theremove_signal_handler
is called on every loop and the loop is removed from the list.This patch changes the behavior of
MultiLoopChildWatcher
. The original idea remains the same but with this patchMultiLoopChildWatcher
can only be used in the main thread.https://bugs.python.org/issue38323