fix(utils): close daemon event loops on shutdown - #9858
Open
RerankerGuo wants to merge 1 commit into
Open
Conversation
Close the event loop after its daemon thread exits so selector and loop resources are released. Keep shutdown idempotent for already closed loops. Test: .venv/bin/python tests/run.py --pattern test_async_rewards.py
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR type
PR information
shutdown_event_loop_in_daemonstopped and joined the daemon thread but leftthe event loop open. The stopped loop retained its selector and related
resources until garbage collection.
This PR closes the loop once its thread has exited. It also returns early for
an already closed loop, making repeated shutdown calls safe. If the thread
does not exit within the existing five-second timeout, the loop is not closed
from another thread.
The change is limited to the daemon event-loop lifecycle helper.
Experiment results
Before the fix:
After the fix: