-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix osrf.py_common.process_utils.get_loop() implementation #70
Conversation
On Windows, avoid loops closing during garbage collection and reuse existing ones if possible. Signed-off-by: Michel Hidalgo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a naive view, it looks like this shouldn't be necessary; the first time we come in here, the TLS loop_has_been_setup
will be False, we'll unconditionally create the ProactorEventLoop
, and then set loop_has_been_setup
to True. Subsequent invocations should always just use the earlier get_event_loop
. Could you explain a bit more why this is needed?
Thing is, the event loop for the current thread may have already been set (e.g. through regular IMHO, this is both a bug in |
omg, wonderful finding 😅 |
Wow, deep stuff. Good find. So am I right in thinking that the main fix here is the close of the old loop and the open of a new |
I didn't know the context for the issue. I just assumed the closing in the gc might be an issue if it is actually a singleton but didn't ask after it. Nice to hear the explanation. I agree a comment detailing why this code is like this would be useful. |
Signed-off-by: Michel Hidalgo <[email protected]>
On Windows, avoid loops closing during garbage collection and reuse existing ones if possible. Signed-off-by: Michel Hidalgo <[email protected]>
On Windows, avoid loops closing during garbage collection and reuse existing ones if possible. Signed-off-by: Michel Hidalgo <[email protected]>
On Windows, avoid loops closing during garbage collection and reuse existing ones if possible.
Connected to ros2/launch#476.