mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Prevent printing crash report in a loop
In the event that we are crashing due to a corrupt Ruby stack, we might re-enter rb_vm_bugreport() due to failed assertions in rb_backtrace_print_as_bugreport() or SDR(). In these cases we were printing the bug report ad infinitum with unbounded recusion. I seem to run into this every once in a while and the amount of log it prints out is pretty distracting. On CI environments it makes the log output unnecessarily big. Let's fix this.
This commit is contained in:
parent
9125374726
commit
e4fe347302
Notes:
git
2022-06-04 02:51:00 +09:00
1 changed files with 11 additions and 0 deletions
11
vm_dump.c
11
vm_dump.c
|
@ -1021,6 +1021,17 @@ rb_vm_bugreport(const void *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
// Thread unsafe best effort attempt to stop printing the bug report in an
|
||||
// infinite loop. Can happen with corrupt Ruby stack.
|
||||
{
|
||||
static bool crashing = false;
|
||||
if (crashing) {
|
||||
fprintf(stderr, "Crashed while printing bug report\n");
|
||||
return;
|
||||
}
|
||||
crashing = true;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
# define PROC_MAPS_NAME "/proc/self/maps"
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue