Skip to content

A platform for community discussion. Free, open, simple.

extra diagnostics for thread issues

Sam4d984a5a63bd
diff --git a/spec/components/scheduler/manager_spec.rb b/spec/components/scheduler/manager_spec.rb
index 4e96014726b..aeaa9a3e648 100644
--- a/spec/components/scheduler/manager_spec.rb
+++ b/spec/components/scheduler/manager_spec.rb
@@ -61,7 +61,11 @@ describe Scheduler::Manager do
before do
expect(ActiveRecord::Base.connection_pool.connections.length).to eq(1)
@thread_count = Thread.list.count
- @thread_ids = Thread.list.map { |t| t.object_id }
+
+ @backtraces = {}
+ Thread.list.each do |t|
+ @backtraces[t.object_id] = t.backtrace
+ end
end
after do
@@ -81,11 +85,17 @@ describe Scheduler::Manager do
on_thread_mismatch = lambda do
current = Thread.list.map { |t| t.object_id }
- extra = current - @thread_ids
- missing = @thread_ids - current
+ old_threads = @backtraces.keys
+ extra = current - old_threads
+
+ missing = old_threads - current
if missing.length > 0
STDERR.puts "\nMissing Threads #{missing.length} thread/s"
+ missing.each do |id|
+ STDERR.puts @backtraces[id]
+ STDERR.puts
+ end
end
if extra.length > 0