Open vt-alt opened 1 year ago
Thanks for reporting this to Us. Do you have any example code that we can reproduce this issue?
This is our experimental debuginfod server (config). But without our dataset I'm not sure you will be able to easily run it. I will try to minify it later when have more time for this. It's run there https://debuginfod.altlinux.org/ after that internal crash some functions work some not.
I will try to minify it later when have more time for this.
OK. Even tiny example from https://unit.nginx.org/howto/samples/#ruby crashes:
from app = Proc.new do |env|
["200", {
"Content-Type" => "text/plain",
}, ["Hello, Ruby on Unit!"]]
end
run app
So we can rule out influence of bundler and rocksdb.
On 'minified' system environment this does not crash. I will try to catch the difference. 👷
Excuse me, (after much experimenting) I just realized that this message is happening not on unitd
start but on unitd
termination. Because I was restarting with systemctl restart unit
termination and start events are so close in time that I thought stack trace was on the start (and relating to some unitd
thread or process while other parts continue to work).
This perhaps still a bug, even though it isn't as Important as I thought before.
It's reproducible on quite bare system (on ALT Linux) with example configs (from docs), with killall unitd
(I didn't find other termination method).
If this behavior is intentional please close the issue. But I'd wish there is graceful termination method. 🤷
Thanks for isolating this segfault - it gives us something to start with. It might be by design but will investigate.
Sounds like it might be a long standing issue with various fixes, but not 100% 2bd4a455278dbce756c1dc8be07515f73d611e3b, b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc, #562
Yes these are from 2022 but we have 1.30.0
which is 2023.
The point is, this is likely a known issue that remains unresolved.
Could you test without threads in your config, just remove or comment out that config line.
Just tested it (several times) and it still crashes.
root@debuginfo:~# jobs
[1]+ Running tail -f /var/log/unit/unit.log &
root@debuginfo:~# unitc /config/applications
{
"debuginfod": {
"type": "ruby",
"working_directory": "/home/indexer/debuginfer",
"user": "_cgi",
"group": "indexer",
"script": "debuginfod.ru"
}
}
root@debuginfo:~# killall unitd
2023/08/28 06:02:22 [notice] 3198281#3198281 signal signo:15 (SIGTERM) received
NGINX_Unit: [BUG] Segmentation fault at 0x0000000000000040
As long as you're not using threads, this patch still prevents the crash
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index bcb48f6b..8807edd2 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -380,7 +380,7 @@ nxt_ruby_start(nxt_task_t *task, nxt_process_data_t *data)
}
rc = (intptr_t) rb_thread_call_without_gvl2(nxt_ruby_unit_run, unit_ctx,
- nxt_ruby_ubf, unit_ctx);
+ RUBY_UBF_IO, NULL);
if (nxt_ruby_hook_procs != Qnil) {
rb_protect(nxt_ruby_hook_call, nxt_rb_on_thread_shutdown, &state);
That works at least with Ruby 3.1.2
I guess something changed in Ruby from when 2bd4a455278dbce756c1dc8be07515f73d611e3b went in that means it no longer works... (although it's now not clear to me what cases that did fix...).
Unit crashes with ruby module (on ALT Linux).
unit.log
:(I may attach full log if you request.) I think no ruby script should do that.
Versions: