[jboss-jira] [JBoss JIRA] (JBMESSAGING-1954) MessagePostOffice.routeInternal() method may fail to release the readlock

Yong Hao Gao (JIRA) issues at jboss.org
Tue Jul 22 11:33:30 EDT 2014


Yong Hao Gao created JBMESSAGING-1954:
-----------------------------------------

             Summary: MessagePostOffice.routeInternal() method may fail to release the readlock
                 Key: JBMESSAGING-1954
                 URL: https://issues.jboss.org/browse/JBMESSAGING-1954
             Project: JBoss Messaging
          Issue Type: Bug
          Components: Messaging Core
    Affects Versions: 1.4.8.SP11
            Reporter: Yong Hao Gao
            Assignee: Yong Hao Gao
             Fix For: 1.4.8.SP12


This method first grabs the read lock and then release it in the finally block. However some statements are outside the try{}finally block so there is a chance the lock will never be released. The code is something like:

   private RouteResult routeInternal(...) throws Exception
   {
      //get the read lock
      lock.readLock().acquire();
      ...

      //check inactive condition
      if (inactiveConditions.contains(condition))
      {
         //look if this happens the readlock will NEVER be released!!!!
         throw new IllegalStateException("Destination " + condition + " not active!");
      }
      
      try
      {
         //do somework
         ......
      }
      finally
      {
         //release lock here
         lock.readLock().release();
      }

Once it happens, it will block any attempts to get the write lock, and also block any further attempts to get read lock. Make those threads blocking forever.




--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list