hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivàn Silva (JIRA) <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-633) MultiThreadedHttpConnectionManager does not properly respond to thread interrupts
Date Thu, 21 Jul 2011 19:52:59 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13069161#comment-13069161

Ivàn Silva commented on HTTPCLIENT-633:

Hi group, I need to know what problem Can I have with this extract
ionPool@0x00000000408C3638/0x00000000408C3644: <unowned>                
Waiting to be notified:                                                 
   "WebContainer : 0" (0x0000000031B71C00)                              
   "WebContainer : 1" (0x0000000031AE6700)                              
   "WebContainer : 2" (0x0000000031E22900)                              
   "WebContainer : 3" (0x000000003202AF00)                              
   "WebContainer : 5" (0x0000000031CCDB00)                              
   "WebContainer : 6" (0x0000000032294B00)                              
     "WebContainer : 55" (0x0000000032620000)                           
     "WebContainer : 56" (0x000000003266F200)                           
     "WebContainer : 58" (0x000000003267CE00)                           
     "WebContainer : 59" (0x000000003267DE00)                           
"WebContainer : 0" J9VMThread:0x0000000031B71C00,                       
java/lang/Object.wait(Native Method)                                    
java/lang/Object.wait(Object.java:196(Compiled Code))                   

Can you help me please? Can be MultiThreadedHttpConnectionManager don't properly respond to
thread interrupts?

> MultiThreadedHttpConnectionManager does not properly respond to thread interrupts
> ---------------------------------------------------------------------------------
>                 Key: HTTPCLIENT-633
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-633
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 3.1 Beta 1
>            Reporter: John Goodwin
>            Assignee: Michael Becke
>             Fix For: 3.1 RC1
>         Attachments: mthcm-interruption.patch, mthcm-interruption.patch
> MultiThreadedHttpConnectionManager uses interrupts to notify waiting threads when a connection
is ready for them. Issues arise if the threads are interrupted by someone else while they
are still waiting on a thread, because doGetConnection does not remove the threads from the
queue of waiting threads when they are interrupted:
>                         connectionPool.wait(timeToWait);
>                         // we have not been interrupted so we need to remove ourselves
from the 
>                         // wait queue
>                         hostPool.waitingThreads.remove(waitingThread);              
>                     } catch (InterruptedException e) {
>                         // do nothing                    } finally {
>                         if (useTimeout) {
>                             endWait = System.currentTimeMillis();
>                             timeToWait -= (endWait - startWait);                    
   }                    }
> Under ordinary circumstances, the queue maintenance is done by the notifyWaitingThread
method. However, if the thread is interrupted by any other part of the system, it will (1)
not actually be released, since the loop in doGetConnection will force it back to the wait,
and (2) will be added the waiting thread to the queue repeatedly, which basically means that
the thread will eventually receive the interrupt from notifyWaitingThread at some later point,
when it is no longer actually waiting for a connection.
> This code could probably be re-architected to make it less error-prone, but the fundamental
issue seems to be the use of interrupts to signal waiting threads, as opposed to something
like a notify. 

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message