Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-414

HTTP Connection closed when polling an API every 5 seconds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 4.4.4
    • None
    • HttpCore NIO

    Description

      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 :
        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)
        

      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 :
        Thread.sleep(POLLING_FREQUENCY_IN_MS);
        
      • 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dominique.mongelli@streamdata.io Dominique Mongelli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: