mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add DISCOURSE_DUMP_BACKTRACES_ON_UNICORN_WORKER_TIMEOUT env (#27199)
This commit adds a `DISCOURSE_DUMP_BACKTRACES_ON_UNICORN_WORKER_TIMEOUT` environment that will allow us to dump all backtraces for all threads of a Unicorn worker 2 seconds before it times out. In development, backtraces are dumped to `STDOUT` and in production we will dump it to `unicorn.stdout.log`. We want to dump all the backtraces to make it easier to identify the cause of a Unicorn worker timing out.
This commit is contained in:
committed by
GitHub
parent
3a91a92563
commit
6cafe59c76
@@ -268,4 +268,9 @@ end
|
||||
after_fork do |server, worker|
|
||||
DiscourseEvent.trigger(:web_fork_started)
|
||||
Discourse.after_fork
|
||||
|
||||
Signal.trap("USR2") { puts <<~MSG }
|
||||
[#{Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%6N")} ##{Process.pid}] Received USR2 signal, dumping backtrace for all threads
|
||||
#{Thread.list.map { |t| "#{t.backtrace&.join("\n")}" }.join("\n\n")}
|
||||
MSG
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user