I am not closing the httpclient.close()- so what will happen to connections when request is completed ? Will the socket close be called at all after each request complete?
On Sat, Aug 22, 2015 at 3:13 PM, Stefan Magnus Landrø < [email protected]> wrote: > > > Sendt fra min iPhone > > > Den 22. aug. 2015 kl. 10.21 skrev Shushant Arora < > [email protected]>: > > > > Check with jvm to see what happens when sockets are closed . How ? > > Java doc and oracle jvm doc > > > > > > Do you mean GC ? I have a Singleton class which internally > > created CloseableHttpAsyncClientobject using > > PoolingNHttpClientConnectionManager .So > > object should stay till JVM is not crashed but connections are gone not > > able to understand ? > > > > Can you elabborate ? > > > > On Sat, Aug 22, 2015 at 1:21 PM, Stefan Magnus Landrø < > > [email protected]> wrote: > > > >> Have a look at the sources to see what http client does when closed. > >> > >> Check with jvm to see what happens when sockets are closed > >> > >> Sendt fra min iPhone > >> > >>>> Den 22. aug. 2015 kl. 08.14 skrev Shushant Arora < > >>> [email protected]>: > >>> > >>> What is the state of connections when all sent requests are completed > >> and I > >>> don't call close on httpclient. > >>> > >>> 1.When requests are being sent and I observe on shell using $ ss -ta > - i > >>> can see connections in Established-sync send state. But when no > requests > >>> are sent - nothing is displayed - connections count is 0 and i never > see > >>> any connection transit to TIME_WAIT or close state how connections > count > >>> reduced to 0 without transitioning to close state ? > >>> > >>> But when I call client.close after requests are complted - connections > >> do > >>> transit to close state and wait there till fin_time (~1 min ) and get > >>> terminates. > >>> > >>> On Fri, Aug 21, 2015 at 10:25 AM, Stefan Magnus Landrø < > >>> [email protected]> wrote: > >>> > >>>> > >>>> > >>>> Sendt fra min iPhone > >>>> > >>>>>> Den 21. aug. 2015 kl. 00.39 skrev Shushant Arora < > >>>>> [email protected]>: > >>>>> > >>>>> Thanks ! > >>>>> > >>>>> shall the value of tcp_fin_timeout be reduced(from default 60 to 30) > in > >>>>> heavy concurrent requests? > >>>> > >>>> Heavy? What do you mean? > >>>> > >>>>> Does it have any side affect? > >>>> > >>>> Seriously? > >>>> > >>>>> > >>>>> On Fri, Aug 21, 2015 at 2:12 AM, Stefan Magnus Landrø < > >>>>> [email protected]> wrote: > >>>>> > >>>>>> > >>>>>> > >>>>>> Sendt fra min iPhone > >>>>>> > >>>>>>>> Den 20. aug. 2015 kl. 21.06 skrev Shushant Arora < > >>>>>>> [email protected]>: > >>>>>>> > >>>>>>> A doubt regarding async client - does it sends the request on same > >>>>>>> connection before waiting for repose of previous request on same > >>>>>> connection > >>>>>> > >>>>>> No request multiplexing in http 1.1 > >>>>>> > >>>>>>> ? Or it will reuse the connection only when first request's > response > >>>> has > >>>>>>> arrived or request timeouts ? > >>>>>>> > >>>>>>> Since I doubt connection close is not coming because of server > >> rather > >>>>>>> client machine tcp socket connections limit - Same http client with > >>>> same > >>>>>>> pool size to same same server is working fine but giving connection > >>>> close > >>>>>>> exception on another machine. > >>>>>>> > >>>>>>> > >>>>>>> When I saw the value of sysctl net.ipv4.ip_local_port_range > >>>>>>> On machine where exceptions are coming its > >>>>>>> net.ipv4.ip_local_port_range = 32768 61000 > >>>>>>> but on another machibe its net.ipv4.ip_local_port_range = 1024 > >>>> 65500 > >>>>>>> > >>>>>>>> On Thu, Aug 20, 2015 at 8:40 PM, Oleg Kalnichevski < > >> [email protected]> > >>>>>> wrote: > >>>>>>>> > >>>>>>>>> On Thu, 2015-08-20 at 20:31 +0530, Shushant Arora wrote: > >>>>>>>>> but its failing my job .Is there any eviction policy I should be > >>>>>> handling > >>>>>>>>> or its automatically taken care of evicting the closed > connections. > >>>>>>>> > >>>>>>>> You have not been listening, have you? The server closes the > >>>> connection > >>>>>>>> on its end _prematurely_. > >>>>>>>> > >>>>>>>> Oleg > >>>>>>>> > >>>>>>>>>> On Thu, Aug 20, 2015 at 8:02 PM, Oleg Kalnichevski < > >>>> [email protected]> > >>>>>>>>> wrote: > >>>>>>>>> > >>>>>>>>>>> On Thu, 2015-08-20 at 20:00 +0530, Shushant Arora wrote: > >>>>>>>>>>> Unplugging is not possible. > >>>>>>>>>>> > >>>>>>>>>>> How to capture the exception in code and detect if a connection > >> is > >>>>>>>>>> closed - > >>>>>>>>>>> don't use it in further requests and create new one in pool > (set > >> to > >>>>>>>> max > >>>>>>>>>>> connnection pool)? > >>>>>>>>>> > >>>>>>>>>> HttpClient manages persistent connections internally and > >>>> automatically > >>>>>>>>>> discards connections that cannot be re-used. > >>>>>>>>>> > >>>>>>>>>> Oleg > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>>> On Thu, Aug 20, 2015 at 7:55 PM, Oleg Kalnichevski < > >>>> [email protected] > >>>>>>>>> > >>>>>>>>>> wrote: > >>>>>>>>>>> > >>>>>>>>>>>>> On Thu, 2015-08-20 at 19:55 +0530, Shushant Arora wrote: > >>>>>>>>>>>>> how to avoid this exception - how to handle this. > >>>>>>>>>>>> > >>>>>>>>>>>> Unplugging your computer from the network will reliably > >> eliminate > >>>>>>>> the > >>>>>>>>>>>> problem. > >>>>>>>>>>>> > >>>>>>>>>>>> Oleg > >>>>>>>>>>>> > >>>>>>>>>>>>> On Thu, Aug 20, 2015 at 7:45 PM, Oleg Kalnichevski < > >>>>>>>> [email protected] > >>>>>>>>>>> > >>>>>>>>>>>> wrote: > >>>>>>>>>>>>> > >>>>>>>>>>>>>>> On Thu, 2015-08-20 at 19:43 +0530, Shushant Arora wrote: > >>>>>>>>>>>>>>> Hi > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> I am using HttpAsyncClients and > >>>>>>>>>> PoolingNHttpClientConnectionManager . > >>>>>>>>>>>>>>> Getting below exception when I increase no of http clients > on > >>>>>>>>>>>> machine. > >>>>>>>>>>>>>> What > >>>>>>>>>>>>>>> could be the reason and solution for this. > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> org.apache.http.ConnectionClosedException: Connection > closed > >>>>>>>>>>>>>>> at > >> > org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:321) > >>>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> The opposite endpoint closed the connection on its end > without > >>>>>>>>>>>> correctly > >>>>>>>>>>>>>> completing the message. > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> Oleg > >> > 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 > >> > org.apache.http.impl.nio.reactor.SessionInputBufferImpl.fill(SessionInputBufferImpl.java:206) > >>>>>>>>>>>>>>> at > >> > org.apache.http.impl.nio.codecs.AbstractMessageParser.fillBuffer(AbstractMessageParser.java:138) > >>>>>>>>>>>>>>> at > >> > org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:243) > >>>>>>>>>>>>>>> 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:3 > >>>> --------------------------------------------------------------------- > >>>>>>>>>>>>>> To unsubscribe, e-mail: > >>>>>>>> [email protected] > >>>>>>>>>>>>>> For additional commands, e-mail: > >>>>>>>>>> [email protected] > >> --------------------------------------------------------------------- > >>>>>>>>>>>> To unsubscribe, e-mail: > >>>> [email protected] > >>>>>>>>>>>> For additional commands, e-mail: > >>>>>>>> [email protected] > >>>> --------------------------------------------------------------------- > >>>>>>>>>> To unsubscribe, e-mail: > >> [email protected] > >>>>>>>>>> For additional commands, e-mail: > >>>> [email protected] > >> --------------------------------------------------------------------- > >>>>>>>> To unsubscribe, e-mail: > [email protected] > >>>>>>>> For additional commands, e-mail: > >> [email protected] > >>>>>> > >>>>>> > --------------------------------------------------------------------- > >>>>>> To unsubscribe, e-mail: [email protected] > >>>>>> For additional commands, e-mail: > [email protected] > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: [email protected] > >>>> For additional commands, e-mail: [email protected] > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
