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 A4E7D114EC for ; Wed, 17 Sep 2014 08:09:13 +0000 (UTC) Received: (qmail 42871 invoked by uid 500); 17 Sep 2014 08:09:12 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 42837 invoked by uid 500); 17 Sep 2014 08:09:12 -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 42826 invoked by uid 99); 17 Sep 2014 08:09:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Sep 2014 08:09:12 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [5.148.180.21] (HELO kalnich2.nine.ch) (5.148.180.21) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Sep 2014 08:09:05 +0000 Received: from [192.168.42.18] (unknown [213.55.184.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by kalnich2.nine.ch (Postfix) with ESMTPSA id 21E62160224 for ; Wed, 17 Sep 2014 08:08:42 +0000 (UTC) Message-ID: <1410941321.2956.5.camel@ubuntu> Subject: Re: PoolingHttpClientConnectionManager and CloseableHttpResponse From: Oleg Kalnichevski To: HttpClient User Discussion Date: Wed, 17 Sep 2014 10:08:41 +0200 In-Reply-To: References: <1410856202.17023.14.camel@ubuntu> <541889B0.8020708@apache.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Tue, 2014-09-16 at 15:49 -0400, Todd W Lainhart wrote: > > > > The connection manager has no way of knowing if a connection is still > > being used. No matter what it needs to be notified that the connection > > can be re-claimed (and either kept alive for further re-use or > > discarded). The #release method looks like a natural way of doing that. > > > > Oleg > > > > Thanks - I'm still trying to grok, at a lower-level, the relationship > between the connection, the manager, and the pool. I've got past the > connection pool shutdown problem (my code). I'm now seeing ISE raised on > an unexpectedly closed HttpConnection (stack trace below). I'm not > getting this one, as the RequestExecutor is successfully sending the > request, but it's erring out on the closed connection. > > Assuming that the connection is not shared across threads, and not being > closed by another thread, what would be a cause of the unexpected > connection close between the request and response? > HttpUriRequest#abort method shuts down the underlying connection. Any further interaction with the same connection is likely to result in ConnectionShutdownException. > Thanks for your help. My suspicion is that there is still someone holding > onto a connection, while in parallel, the connection manager from which > that connection was provisioned is shutdown. I'm wondering if there might > be another scenario. > This can happen if the request is aborted while still being executed. However, the #abort method usually needs to be called from another thread. Oleg > > > Caused by: java.lang.IllegalStateException: Connection is not open > at org.apache.http.util.Asserts.check(Asserts.java:34) > at > org.apache.http.impl.BHttpConnectionBase.ensureOpen(BHttpConnectionBase.java:128) > at > org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseEntity(DefaultBHttpClientConnection.java:172) > at > org.apache.http.impl.conn.CPoolProxy.receiveResponseEntity(CPoolProxy.java:157) > at > org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) > at > org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123) > at > org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254) > at > org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) > at > org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) > at > org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) > at > org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org