Repository navigation
vm: a thread dying of an exception reports it, and Thread#to_s has its line - #986
Merged
Merged
Conversation
…s line A thread that ended on an unhandled exception while report_on_exception was true printed nothing; MRI writes "<Thread#to_s> terminated with exception (report_on_exception is true):" and the error through $stderr#write, before the thread is marked dead (thread.c thread_start_func_2, v4.0.10:733-739). A SystemExit is not reported, and the per-thread flag and the inherited class-level default both silence it. The accessors were already honoured; the "rbgo does not print" comment is gone with the gap. Thread#to_s printed "FILE:0" and an unpadded address. The line is now the block's first line (rb_thread_to_s appends rb_proc_location) and the address is 16 hex digits, as rbgo's other identity reprs are. Tests whose subject is not the report now set Thread.report_on_exception = false, as ruby/spec's thread fixtures do: MRI would print the report for those programs too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With report_on_exception true by default, three cases of TestBlockingWaitNotInterruptedWhenItShouldNotBe received the report MRI writes to $stderr for a thread that dies with an exception: the harness gives the VM one writer for both streams, so it landed in the compared output on every CI lane. Those cases test that a wait is not ended, not the report, so each sets Thread.report_on_exception = false first, as a Ruby test of the same thing would. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ubuntu coverage ratchet put reportThreadException at 83.3%: nothing reached the recover that keeps a failing $stderr#write from becoming a second failure, nor the re-panic that keeps a Go-level panic visible. Two internal tests drive each through a $stderr whose #write raises a Ruby error, then panics in Go. MRI 4.0.10 does not return from the first case: a thread dying while $stderr#write raises hangs for the whole 30 s rubydiff budget. rbgo swallows the write failure as rb_ec_error_print's EC_PUSH_TAG intends, and the test says so instead of claiming parity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tannevaled
force-pushed
the
thread-report-on-exception
branch
from
November 29, 2026 17:26
57167f2 to
d3fc22e
Compare
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.
What
A thread that ends on an unhandled exception while
report_on_exceptionis true now reports it, as MRI 4.0.10 does. Before this change rbgo printed nothing; the accessors existed, but a comment said the report was deliberately not printed.Thread#to_s/#inspectalso printedFILE:0and an unpadded address. They now print the block's first line and a 16-digit address.How
reportThreadExceptionfollowsthread_start_func_2(thread.c v4.0.10:726-739):Thread#to_s+" terminated with exception (report_on_exception is true):\n"through$stderr#write, thenException#full_message(the Ruby face ofrb_ec_error_print);run;SystemExitis not reported;rb_ec_error_printdoes.describetakes its line fromrb_proc_locationof the block (FirstLine), asrb_thread_to_sdoes.Thread.report_on_exception = false, as ruby/spec's thread fixtures do. MRI prints the report for those programs too.Evidence
rubydiff -a rbgo -b ruby 4.0.10on the probe program, run directly and throughrequire:origin/main(ed535866): DIVERGE, printing nothing for either thread.TestThreadReportOnExceptionandTestThreadReportSkipsSystemExit(new) use MRI 4.0.10's output.gofmt -l: clean.Not in this PR (found while measuring)
The report body still differs from MRI in three ways, each a backtrace defect outside this change:
from prog.rb:3:in '<main>'), which MRI's thread backtrace does not.Array#eachframe of a native iterator is missing.'<main>'where MRI says'<top (required)>'.MRI also prints error_highlight's snippet under the message, and rbgo has no error_highlight. The new test masks the label, so it asserts only what this change owns.
rbgo starts a thread eagerly, so the report can appear before the creating thread's next line where MRI shows it later. That is a scheduling difference, not part of this change.
🤖 Generated with Claude Code