hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Mongelli (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-414) HTTP Connection closed when polling an API every 5 seconds
Date Wed, 18 Nov 2015 17:06:11 GMT

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

Dominique Mongelli commented on HTTPCORE-414:
---------------------------------------------

Hi Oleg,

Thanks for your answer.
The point is if the ConnectionClosedException is thrown from the API then the behaviour should
not depends on the polling frequency.
As the exception is not raised when polling frequency is set to 4 or 6 seconds for example,
we are not able to spot why the behaviour is different for 5 seconds polling frequency.
Any clue on that ?

Thank you.

> HTTP Connection closed when polling an API every 5 seconds
> ----------------------------------------------------------
>
>                 Key: HTTPCORE-414
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-414
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.4.4
>         Environment: OS : Linux Ubuntu 14.04 LTS
> Software : Java 1.8
> Java source code available at the following link :
> https://gist.github.com/dominiquemongelli/34e3588c5a1436276dff#file-httpcoreniosample
> The java program uses the following libraries :
> - httpclient 4.5.1
> - httpcore-nio 4.4.4
> - httpasyncclient 4.1
> - httpcore 4.4.4
>            Reporter: Dominique Mongelli
>            Priority: Minor
>              Labels: connectionclosed, http, http304, httpcore
>
> Scenario to reproduce the bug :
> - The java source code simulates 10 pollings on the following API  http://www.typeunsafe.org/api/temperatures/69
(using httpasyncclient) with 5 seconds polling frequency.
> - Compile and run the source code provided.
> - Current result : after some polling correctly done, the execution throws the following
exception :
> {code:title=|borderStyle=solid}
> Exception in thread "main" java.util.concurrent.ExecutionException: org.apache.http.ConnectionClosedException:
Connection closed
> 	at org.apache.http.concurrent.BasicFuture.getResult(BasicFuture.java:70)
> 	at org.apache.http.concurrent.BasicFuture.get(BasicFuture.java:80)
> 	at HttpCoreSample.main(HttpCoreSample.java:31)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:483)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: org.apache.http.ConnectionClosedException: Connection closed
> 	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:321)
> 	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:263)
> 	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
> 	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
> 	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:116)
> 	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:164)
> 	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339)
> 	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:317)
> 	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:278)
> 	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
> 	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:590)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}
> Important things to mention :
> - The issue does not occur with another API (for example API https://api.bitcoinaverage.com/ticker/global/EUR/)
> - The issue is reproductible only with a 5 seconds polling frequency. If polling frequency
is set to 10 seconds, then the issue is not reproductible anymore.
> The polling frequency can be updated via :
> {code:title= |borderStyle=solid}
> Thread.sleep(POLLING_FREQUENCY_IN_MS);
> {code}
> - The API uses within the source code (http://www.typeunsafe.org/api/temperatures/69)
can return a 304 http status when no data has been updated.
> - The API uses a Varnish cache layer.



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

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


Mime
View raw message