hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpCore NIO and recycling connections
Date Tue, 22 Sep 2009 21:40:03 GMT
Peter Soles wrote:
> No need to apologize, I certainly appreciate your responses!  To answer your
> question, no, I don't call NHttpClientConnection#suspendInput in my code
> prior to putting the connection on my re-use queue.
> 
> As a possibly irrelevant point, my code functions on my Linux server if I
> circumvent my connection recycler but of course I'd rather not do that :-).
> Under Windows, the connection recycling seems to work just find and I get no
> errors.
> 
> Does the fact that tcpdump doesn't report any outgoing message for the
> request that fails give me any clues as to what is happening?  I'll have to
> take a look at the logging pointers you sent me.
> 
> Peter
> 

Peter,

To me it is perfectly clear what is happening. While a persistent 
connection was sitting idle in the re-use queue it was closed by the 
peer on the opposite end and had become half-closed. That explains why 
there is no outgoing message recorded by tcpdump. (The message was 
submitted to the connection but nothing got sent across the wire as the 
socket was already closed on the opposite end.) However, I always 
assumed the I/O selector would get immediately notified of such an event 
and the protocol handler would be able to react intelligently to it, for 
instance, by removing the connection from the queue. The question is why 
it does not happen, and since it appears to be platform specific in your 
case I tend to suspect a JRE bug / an OS issue.

A debug log would probably be quite helpful.

Oleg


> On Tue, Sep 22, 2009 at 5:06 PM, Oleg Kalnichevski <olegk@apache.org> wrote:
> 
>> Peter Soles wrote:
>>
>>> Thanks for the response and the pointers to your code.  I'll definitely
>>> take
>>> a look!
>>>
>>> I'm not clearing the read event notifications in the persistent
>>> connection.
>>> In my code, the connection is "born" when I get it from I
>>> NHttpClientHandler.connected() and I just place it on my re-use queue at
>>> the
>>> end of HttpRequestExecutionHandler.handleResponse(). When I need to
>>> re-use,
>>> I just check NHttpClientConnection.getStatus == ACTIVE and
>>> NHttpClientConnection.isOpen() == true.
>>>
>>> Should I be calling NHttpClientConnection.resetOutput()/resetInput()
>>> before
>>> I try and re-use the connection?
>>>
>>> thanks again!
>>>
>>> Peter
>>>
>>>
>> Sorry for not being specific enough. Do you call
>> NHttpClientConnection#suspendInput() anywhere in your code prior to putting
>> the connection on the re-use queue?
>>
>>
>> Oleg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
> 


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


Mime
View raw message