[ 
https://issues.apache.org/jira/browse/HTTPASYNC-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15402660#comment-15402660
 ] 

Bindul Bhowmik edited comment on HTTPASYNC-109 at 8/1/16 7:31 PM:
------------------------------------------------------------------

Kirill,

If you set the setSoKeepAlive, the networking layer in Java will send 
intermittent TCP Keep Alive packets and the firewall won't see the connection 
as idle.

However, if the code you have pasted above is your actual production code, I 
don't think the firewall is the problem. You are not doing anything with the 
HttpResponse object that you get in the completed method, so none of the 
associated resources are released back to the pool causing your pending set to 
fill up and all further requests being held back.

Please read the HTTP Client Tutorial on the impact of not consuming the 
response content and releasing resources [1].

On the mailing list, please see [2].

Bindul

[1] 
http://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamentals.html#d5e145
[2] http://hc.apache.org/mail.html


was (Author: bindul):
Kirill,

If you set the setSoKeepAlive, the networking layer in Java will send 
intermittent TCP Keep Alive packets and the firewall won't see the connection 
as idle.

However, if the code you have pasted above is your actual production code, I 
don't think the firewall is the problem. You are not doing anything with the 
HttpResponse object that you get in the completed method, so none of the 
associated resources are released back to the pool causing your pending set to 
fill up and all further requests being held back.

Please read the HTTP Client Tutorial on the impact of not consuming the 
response content and releasing resources [1].

Bindul

[1] 
http://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamentals.html#d5e145

> Requests in AbstractNIOConnPool.pending stays forever.
> ------------------------------------------------------
>
>                 Key: HTTPASYNC-109
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-109
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.2
>            Reporter: Kirill Barkunov
>
> Hi!
> I have a client built this way:
> {code}
> IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>             .setIoThreadCount(Runtime.getRuntime().availableProcessors())
>             .setConnectTimeout(30000)
>             .setSoTimeout(30000)
>             .build();
>     private CloseableHttpAsyncClient httpAsyncClient = 
> HttpAsyncClients.custom().setMaxConnTotal(150).setMaxConnPerRoute(130).setDefaultIOReactorConfig(ioReactorConfig).build();
> {code}
> I've noticied that on environment with a firewall enabled (I think it cuts 
> all the socket connection 5 minutes after their establishing) after some time 
> client stops sending https request. After a small investigation I've started 
> to monitor insides of the client and noticied that a few minutes after the 
> client start - AbstractNIOConnPool.pending collection starts to grow. At 
> start it's 0. After few minutes it's 1-2. Then it starts to grow faster and 
> few minutes later it reaches maximum number of connections per route. And it 
> stops work forever. Only AbstractNIOConnPool.leasingRequests grows and no one 
> of the new requests are processed.
> Target for all the requests is www.googleapis.com
> As I can understand from client insides load is like 1-5 request at a time.
> I mean before first "dead" request in AbstractNIOConnPool.pending the number 
> of "leased" and "available" is not more than 5.
> Best regards, Kirill.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to