fix(profiling): Ensure profiler thread exits when needed#4497
Merged
Zylphrex merged 1 commit intoJun 19, 2025
Conversation
The soft exit wasn't properly shutting down the thread if another profiler started up too quickly. This ensures it is reused if possible but is properly shutdown if needed. Specifically, the shutdown allowed the profiler 1 cycle before actually shutting down. If another profiler is started during this cycle, it's possible the old profiler never shuts down. Resulting in multiple profilers running.
Member
Author
|
It's difficult to write a test that reliably reproduces the IndexError as it is heavily dependent on the timing of the profiler thread. But I was able to reproduce the exact error locally a few times to verify the scenario in which it occurs and that this should fix it. |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #4497 +/- ##
==========================================
+ Coverage 80.57% 80.65% +0.07%
==========================================
Files 142 142
Lines 16051 16057 +6
Branches 2747 2748 +1
==========================================
+ Hits 12933 12950 +17
+ Misses 2248 2239 -9
+ Partials 870 868 -2
|
sl0thentr0py
approved these changes
Jun 19, 2025
Member
Author
|
For visibility, reproducing the issue requires the following when using
|
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.
The soft exit wasn't properly shutting down the thread if another profiler started up too quickly. This ensures it is reused if possible but is properly shutdown if needed.
Specifically, the shutdown allowed the profiler 1 cycle before actually shutting down. If another profiler is started during this cycle, it's possible the old profiler never shuts down. Resulting in multiple profilers running.
Fixes #4489