From 584c1759c475c5e875a6038ee8a4227498e6f0b0 Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Fri, 18 Dec 2015 18:04:21 +0800 Subject: [PATCH] Re-enable GC if stack overflow was caught from signal handler Ruby SIGSEGV/SIGBUG signal handlers turn off GC even if it was handled (e.g. native stack overflow). So, if any thread recovered from stack overflow (except main), GC remains disabled. No further objects and threads will be garbage collected, thus it’s necessary to turn on GC back before returning to ruby execution. Please review attached patch fixing this issue. --- ChangeLog | 7 +++++++ signal.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a8d6909..1640328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Nov 19 15:53:21 2015 Alex Gaziev + + + * signal.c: should also clear ruby_disable_gc. + + [Bug #11692] + Sun Nov 8 23:30:56 2015 Koichi Sasada * vm_trace.c (rb_threadptr_exec_event_hooks_orig): diff --git a/signal.c b/signal.c index dcce2b2..4faf381 100644 --- a/signal.c +++ b/signal.c @@ -745,7 +745,7 @@ rb_get_next_signal(void) #if defined SIGSEGV || defined SIGBUS || defined SIGILL || defined SIGFPE static const char *received_signal; -# define clear_received_signal() (void)(received_signal = 0) +# define clear_received_signal() (void)(ruby_disable_gc=0, received_signal = 0) #else # define clear_received_signal() ((void)0) #endif -- 1.9.5 (Apple Git-50.3)