Funky deadlocking of activerecord thread by Test::Unit

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:insend
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:inrun’
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:inrun’
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:ineach’
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:inrun_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:instart’
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:inrun’
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