# Funky deadlocking of activerecord thread by Test::Unit

**URL:** <https://www.ruby-forum.com/t/funky-deadlocking-of-activerecord-thread-by-test-unit/89057>\
**Category:** Rails\
**Created:** [March 16, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/funky-deadlocking-of-activerecord-thread-by-test-unit/89057 "2007-03-16T20:51:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![soroe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@soroe](https://www.ruby-forum.com/u/soroe)\
**Post date:** [March 16, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/funky-deadlocking-of-activerecord-thread-by-test-unit/89057/1 "2007-03-16T20:51:57Z")

</div>

Hey Guys,

The following works fine. TaskInterrupt is a ActiveRecord subclass.

require File.dirname( **FILE** ) + ‘/…/test\_helper’

def test\_1  
aproc = lambda{ TaskInterrupt.new.pause(‘blue’) }  
threads = Thread.new(aproc) { |r| aproc.call }  
threads.join  
puts “join done”  
end

test\_1

However the following yields deadlock errors shown at the end of this  
posting. As you can see the only difference between these two is that  
the latter uses the Test::Unit Framework. Anyone have ideas how I can  
workaround / trace this issue?

require File.dirname( **FILE** ) + ‘/…/test\_helper’

class TestBlue \< Test::Unit::TestCase  
def test\_1  
aproc = lambda{ TaskInterrupt.new.pause(‘blue’) }  
threads = Thread.new(aproc) { |r| aproc.call }  
threads.join  
puts “join done”  
end  
end

deadlock 0x288c80c: sleep:J(0x39b42c4) (main) - unit/test.rb:8  
deadlock 0x39b42c4: sleep:- - c:/ruby/lib/ruby/1.8/thread.rb:100  
c:/ruby/lib/ruby/1.8/thread.rb:100:in `test_1': Thread(0x39b42c4): deadlock (fatal) from c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:in` **send** ’  
from c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:in `run' from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in`run’  
from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each' from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in`run’  
from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run' from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in`each’  
from c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run' from c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in`run\_suite’  
from  
c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in  
`start_mediator' from c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in`start’  
from  
c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run' from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:200:in`run’  
from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:13:in `run’  
from c:/ruby/lib/ruby/1.8/test/unit.rb:278  
from unit/test.rb:5
