thread starving in MultiThreadedHttpConnectionManager
-----------------------------------------------------

                 Key: HTTPCLIENT-675
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-675
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpConn
    Affects Versions: 3.1 RC1
            Reporter: Roland Weber
            Assignee: Roland Weber
             Fix For: 3.1 Final


Hi folks,

I might have found a bug in MTHCM. It has to do with removing 
HostConnectionPool instances that have no more connections in them. That was a 
fix for a memory leak we previously had. There are two cases where the pools 
get deleted. One is in handleLostConnection: (excerpt)
  ...
  if (hostPool.numConnections == 0) mapHosts.remove(config);
  notifyWaitingThread(config);
  ...

Could this delete a pool in which there is still a thread waiting to get a 
connection? If so, the thread would remain in the global pool. But even if it 
is interrupted there, it would still use the old HostConnectionPool in which no 
connection will ever become available again.

I suggest to change the removal check in both cases to:
  if ((hostPool.numConnections < 1) && hostPool.waitingThreads.isEmpty)

What do you think?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to