Skip to content

Commit

Permalink
Catch signal TTIN and dump thread traces
Browse files Browse the repository at this point in the history
  • Loading branch information
gerrypower committed Feb 1, 2024
1 parent fb9278e commit 2b76613
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/que/command_line_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,21 @@ def parse(
$stop_que_executable = false
%w[INT TERM].each { |signal| trap(signal) { $stop_que_executable = true } }

trap("TTIN") do
puts 'Dumping thread traces:'
Thread.list.each do |t|
puts "## Thread TID-#{t.object_id.to_s(36)} #{t['label']}"
if t.backtrace
puts t.backtrace.join("\n")
else
puts "\tThread has no backtrace available"
end
end
end

output.puts(
<<~STARTUP
Que #{Que::VERSION} started worker process with:
Debug Que #{Que::VERSION} started worker process with:
Worker threads: #{locker.workers.length} (priorities: #{locker.workers.map { |w| w.priority || 'any' }.join(', ')})
Buffer size: #{locker.job_buffer.maximum_size}
Queues:
Expand Down

0 comments on commit 2b76613

Please sign in to comment.