summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@f5.com>2022-08-31 12:49:15 +0100
committerAndrew Clayton <a.clayton@f5.com>2022-08-31 13:17:02 +0100
commitb26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc (patch)
treed052ba348a5d1f4ef8563dc7ab400bd60e790b19
parentd1cb8ab2bb27a864ec6cb21c5e64af315266100d (diff)
downloadunit-b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc.tar.gz
unit-b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc.tar.bz2
Ruby: prevented a segfault on receiving SIGINT (^C).
As was reported[0] by @travisbell on GitHub, if running unit from the terminal in the foreground when hitting ^C to exit it, the ruby application processes would segfault if they were using threads. It's not 100% clear where the actual problem lies, but it _looks_ like it may be in ruby. The simplest way to deal with this for now is to just ignore SIGINT in the ruby application processes. Unit will still receive and handle it, cleanly shutting everything down. For people who want to handle SIGINT in their ruby application running under unit they can still trap SIGINT and it will override the ignore. [0]: https://github.com/nginx/unit/issues/562#issuecomment-1223229585 Closes: https://github.com/nginx/unit/issues/562
-rw-r--r--docs/changes.xml6
-rw-r--r--src/ruby/nxt_ruby.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/docs/changes.xml b/docs/changes.xml
index 85749bff..586063db 100644
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -107,6 +107,12 @@ the ruby application process could crash if it's interrupted by SIGTERM signal.
<change type="bugfix">
<para>
+prevent the ruby application processes from crashing on SIGINT (^C).
+</para>
+</change>
+
+<change type="bugfix">
+<para>
when isolated PID numbers reach the prototype process host PID,
the prototype crashed.
</para>
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index 07d02dce..f316d8a5 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -270,6 +270,8 @@ nxt_ruby_start(nxt_task_t *task, nxt_process_data_t *data)
static char *argv[2] = { (char *) "NGINX_Unit", (char *) "-e0" };
+ signal(SIGINT, SIG_IGN);
+
conf = data->app;
c = &conf->u.ruby;