Don't clear the ThreadGroup when Thread terminates#8425
Merged
headius merged 1 commit intojruby:masterfrom Nov 14, 2024
Merged
Conversation
CRuby does not clear the ThreadGroup set in the Thread when the thread terminates. We do, which leads to some unpredictability in specs that check the group against a very short-lived thread. This patch removes the call to clear the thread's group.
Member
Author
|
The failure is intermittent but looks like this: It's because in this code, sometimes the group check happens before the thread terminates, and sometimes it happens after. If it happens after, we will have cleared the group. it "returns the thread group explicitly set for this thread" do
thread = Thread.new { nil }
thread_group = ThreadGroup.new
thread_group.add(thread)
thread.group.should == thread_group
ensure
thread.join if thread
end |
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.
CRuby does not clear the ThreadGroup set in the Thread when the thread terminates. We do, which leads to some unpredictability in specs that check the group against a very short-lived thread. This patch removes the call to clear the thread's group.