Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36DF5187A0 for ; Thu, 20 Aug 2015 19:07:03 +0000 (UTC) Received: (qmail 44286 invoked by uid 500); 20 Aug 2015 19:06:59 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 44244 invoked by uid 500); 20 Aug 2015 19:06:59 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 44230 invoked by uid 99); 20 Aug 2015 19:06:59 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Aug 2015 19:06:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 31A60DF92E for ; Thu, 20 Aug 2015 19:06:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.129 X-Spam-Level: *** X-Spam-Status: No, score=3.129 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 9goKq0qP8iu3 for ; Thu, 20 Aug 2015 19:06:57 +0000 (UTC) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id DD16224B15 for ; Thu, 20 Aug 2015 19:06:56 +0000 (UTC) Received: by wijp15 with SMTP id p15so1425718wij.0 for ; Thu, 20 Aug 2015 12:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=1IOvmf3BYKuU6BzqY+Cz2V33/gyLO56oVAHYnLDvJ3A=; b=scDFqmm96QZv06VYvHOlhaA2JVrjqnjB/Bd3Nrbs6G9q0TEQk+xTib3fyJbCwdSt6k ZdnS9SxSkFytRvaUMQh4tHdpvLQHJNbBdQtPWM3RaYNAO/rFBUW3YJvDsSVawgOBUhXg Bvv3ywdYm8I+P1efYcTrb84unPAHryX0XY42aAYU139F8/ziaGvVsmHyO5tzeWvdlsHC 43tjlgl5KfCrQP9teCxYrL64d4P3b0KEnhmCvWwsozS1009KNtrott3Uqq5VzhWVxCNC txqOyYRct0bLBoyg7lSIuH7uPhOp+LDgJLESfP56x4PXy8RTHeDT9JkCTe9bT/AQJ7EZ RYfw== MIME-Version: 1.0 X-Received: by 10.180.24.40 with SMTP id r8mr16441751wif.13.1440097610410; Thu, 20 Aug 2015 12:06:50 -0700 (PDT) Received: by 10.28.130.212 with HTTP; Thu, 20 Aug 2015 12:06:50 -0700 (PDT) In-Reply-To: <1440083401.23312.1.camel@apache.org> References: <1440080148.16880.0.camel@apache.org> <1440080712.16880.2.camel@apache.org> <1440081130.16880.4.camel@apache.org> <1440083401.23312.1.camel@apache.org> Date: Fri, 21 Aug 2015 00:36:50 +0530 Message-ID: Subject: Re: intermittent org.apache.http.ConnectionClosedException: From: Shushant Arora To: HttpClient User Discussion Content-Type: multipart/alternative; boundary=f46d043c805a82ae66051dc2daa9 --f46d043c805a82ae66051dc2daa9 Content-Type: text/plain; charset=UTF-8 A doubt regarding async client - does it sends the request on same connection before waiting for repose of previous request on same connection ? 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 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 > 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 > > > > 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 < > olegk@apache.org > > > > > > > > > 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: > 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 > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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 > > --f46d043c805a82ae66051dc2daa9--