Recursively locking on a mutex results in deadlock
--------------------------------------------------

                 Key: JRUBY-2545
                 URL: http://jira.codehaus.org/browse/JRUBY-2545
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.1
         Environment: Mac OS X Leopard with Java 1.5
            Reporter: Matt Fletcher
         Attachments: test_recursive_mutex_locking.rb

Attached is a test case that demonstrates how recursively synchronizing on a 
mutex results in deadlock. Here is the body of the test:
{noformat}
  def test_mutex_cannot_be_synchronized_twice
    m = Mutex.new
    begin
      m.synchronize do
        m.synchronize do
        end
      end
      flunk "should have raised a ThreadError when synchronizing twice"
    rescue Exception => ex
      assert_kind_of ThreadError, ex, "the exception was not the right type"
      assert_equal "stopping only thread\n\tnote: use sleep to stop forever", 
ex.message, "wrong message in the exception"
    end
  end
{noformat}

This test passes on MRI and deadlocks on JRuby 1.1.1. The test shows that and 
exception is raised, the correct exception type is used, and message from MRI 
is given.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to