From d799d648274a726e96d05177b3382419a6f54996 Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Mon, 16 Nov 2015 01:05:35 +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. --- thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/thread.c b/thread.c index bed6551..4dee20c 100644 --- a/thread.c +++ b/thread.c @@ -2108,6 +2108,7 @@ void ruby_thread_stack_overflow(rb_thread_t *th) { th->raised_flag = 0; + ruby_disable_gc = 0; #ifdef USE_SIGALTSTACK if (!rb_during_gc()) { rb_exc_raise(sysstack_error); -- 1.9.5 (Apple Git-50.3)