From 2bd4a455278dbce756c1dc8be07515f73d611e3b Mon Sep 17 00:00:00 2001 From: Zhidao HONG Date: Thu, 28 Jul 2022 11:00:15 +0800 Subject: [PATCH] Ruby: fixed segfault on SIGTERM signal. This closes #562 issue on GitHub. --- docs/changes.xml | 6 ++++++ src/ruby/nxt_ruby.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index 158f98e9..3ff434aa 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -81,6 +81,12 @@ force SCRIPT_NAME in Ruby to always be an empty string. + + +the ruby application process could crash if it's interrupted by SIGTERM signal. + + + diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index 4df77499..07d02dce 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -377,8 +377,8 @@ nxt_ruby_start(nxt_task_t *task, nxt_process_data_t *data) } } - rc = (intptr_t) rb_thread_call_without_gvl(nxt_ruby_unit_run, unit_ctx, - nxt_ruby_ubf, unit_ctx); + rc = (intptr_t) rb_thread_call_without_gvl2(nxt_ruby_unit_run, unit_ctx, + nxt_ruby_ubf, unit_ctx); if (nxt_ruby_hook_procs != Qnil) { rb_protect(nxt_ruby_hook_call, nxt_rb_on_thread_shutdown, &state);