[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-1653) Locking in EJBContainer during start/stop can cause deadlocks and/or IllegalMonitorStateExceptions

Paul Ferraro (JIRA) jira-events at lists.jboss.org
Mon Dec 22 13:56:54 EST 2008


Locking in EJBContainer during start/stop can cause deadlocks and/or IllegalMonitorStateExceptions
--------------------------------------------------------------------------------------------------

                 Key: EJBTHREE-1653
                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1653
             Project: EJB 3.0
          Issue Type: Bug
          Components: core
    Affects Versions: 1.0.0-Beta11, 1.0.0-Beta12, 1.1.0-Beta1
            Reporter: Paul Ferraro
            Assignee: Paul Ferraro


This relates to the fix implemented for http://jira.jboss.com/jira/browse/EJBTHREE-1116

The locking/unlocking performed during create/start/stop uses a ReentrantReadWrite lock which assumes that the lifecycle events are called by the same thread.  This is not a safe assumption.

If EJBContainer is stopped and restarted by different threads, start() will throw an IllegalMonitorStateException when it tries to unlock the write lock acquired in stop().
Additionally, if EJBContainer is stopped, and a second thread tries to stop it again, that thread will block until it is interrupted.
Since EJBContainer is the only object capable of acquiring the container write lock, the write lock should always be reentrant regardless of thread ownership.

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

        



More information about the jboss-jira mailing list