From b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Wed, 31 Aug 2022 12:49:15 +0100 Subject: 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 --- src/ruby/nxt_ruby.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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; -- cgit