From 2c3d1283b063d60af81ab6ebd52d33b21a949513 Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Mon, 16 Nov 2015 01:11:32 +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 b7056a7..ddd4a96 100644 --- a/thread.c +++ b/thread.c @@ -2083,6 +2083,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)