[jboss-jira] [JBoss JIRA] Created: (JBREM-762) Deadlock bug in socket invoker

Tim McCune (JIRA) jira-events at lists.jboss.org
Thu Jun 28 17:56:57 EDT 2007


Deadlock bug in socket invoker
------------------------------

                 Key: JBREM-762
                 URL: http://jira.jboss.com/jira/browse/JBREM-762
             Project: JBoss Remoting
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: transport
    Affects Versions: 1.4.6.GA
         Environment: JBoss 4.0.4 EJB 3.0-rc9-patch1 JDK 1.6.0
            Reporter: Tim McCune


There is a potential thread leak in ServerThread.java that causes ServerThreads to stick around, but to disappear from the thread pool as the accept() thread(s) see it.  Eventually, when the # of leaked threads reaches the MaxPoolSize, the system ends up deadlocked and will not accept any more incoming socket connections.  I have described the problem in great detail in a forum post and in support case 00016786.  I have patched the code, and so far it seems to be working fine and to have fixed the problem.  This is what I patched:

In ServerThread.java, I wrapped the contents of wakeup() inside of a try/catch, block, with the following code in the catch block:

    } catch (Exception e) {
         synchronized (clientpool) {
            synchronized (threadpool) {
               clientpool.remove(this);
               threadpool.add(this);
               Thread.interrupted();
            }
         }
         throw e;
      }

This makes sure that the thread is put back into the threadpool when an exception occurs in the createServerSocket() method (this method is doing socket I/O in 1.4.6, and in our case, this socket connection was timing out.).

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

        



More information about the jboss-jira mailing list