mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Add thread and ractor counts to bug reports
This is useful for crash triaging. It also helps to hint extension
developers about the misuse of `rb_thread_call_without_gvl()`.
Example:
$ ./miniruby -e 'Ractor.new{Ractor.receive};
Thread.new{sleep}; Process.kill:SEGV,Process.pid'
<snip>
-- Threading information ---------------------------------------------------
Total ractor count: 2
Ruby thread count for this ractor: 2
This commit is contained in:
parent
e0cf80d666
commit
2f81bb793f
Notes:
git
2023-03-16 14:46:56 +00:00
@ -754,6 +754,9 @@ class TestRubyOptions < Test::Unit::TestCase
|
||||
\n
|
||||
)?
|
||||
)x,
|
||||
%r(
|
||||
(?:--\sThreading(?:.+\n)*\n)?
|
||||
)x,
|
||||
%r(
|
||||
(?:--\sMachine(?:.+\n)*\n)?
|
||||
)x,
|
||||
|
||||
@ -1083,6 +1083,14 @@ rb_vm_bugreport(const void *ctx)
|
||||
SDR();
|
||||
rb_backtrace_print_as_bugreport();
|
||||
fputs("\n", stderr);
|
||||
// If we get here, hopefully things are intact enough that
|
||||
// we can read these two numbers. It is an estimate because
|
||||
// we are reading without synchronization.
|
||||
fprintf(stderr, "-- Threading information "
|
||||
"---------------------------------------------------\n");
|
||||
fprintf(stderr, "Total ractor count: %u\n", vm->ractor.cnt);
|
||||
fprintf(stderr, "Ruby thread count for this ractor: %u\n", rb_ec_ractor_ptr(ec)->threads.cnt);
|
||||
fputs("\n", stderr);
|
||||
}
|
||||
|
||||
rb_dump_machine_register(ctx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user