hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neeme Praks (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1396) PoolingClientConnectionManager seems to create one connection too many?
Date Mon, 09 Sep 2013 14:35:51 GMT

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

Neeme Praks commented on HTTPCLIENT-1396:
-----------------------------------------

Sample output on my machine:
{noformat}
2013-09-09 17:31:32.816:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2013-09-09 17:31:32.818:INFO::jetty-6.1.26
2013-09-09 17:31:32.837:INFO::Started SocketConnector@0.0.0.0:52678
sending requests to http://localhost:52678/
response  OK: 1
response  OK: 2
response  OK: 3
response  OK: 4
response  OK: 5
response  OK: 6
response  OK: 7
response  OK: 8
response  OK: 9
response  OK: 10
response  OK: 11
response  OK: 12
response  OK: 13
response  OK: 14
response  OK: 15
response  OK: 16
response  OK: 17
response NOK: java.net.SocketTimeoutException: Read timed out
response  OK: 19
response  OK: 20
2013-09-09 17:31:39.441:INFO::Stopped SocketConnector@0.0.0.0:52678
{noformat}

Exception stacktrace:
{noformat}
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
	at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:1)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
	at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
	at org.apache.http.impl.conn.TestPoolingConnManagerWithJetty$ClientWorker.run(TestPoolingConnManagerWithJetty.java:167)
{noformat}

                
> PoolingClientConnectionManager seems to create one connection too many?
> -----------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1396
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1396
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2.5
>         Environment: Any
>            Reporter: Neeme Praks
>            Priority: Minor
>         Attachments: TestPoolingConnManagerWithJetty.java
>
>
> See attached Junit test.
> You'll also need Jetty dependency:
>     <dependency>
>       <groupId>org.mortbay.jetty</groupId>
>       <artifactId>jetty</artifactId>
>       <version>6.1.26</version>
>       <scope>test</scope>
>     </dependency>
> What the test does:
> * sets up a HTTP server (Jetty) with N number of threads processing requests (MAX_CONNECTIONS
constant).
> * sets up HttpClient with same N number of max connections (PoolingClientConnectionManager)
> * sets up X workers, trying to connect to the server at the same time.
> *Expected result*: although throughput is throttled (limited number of threads and connections),
all workers should get successful response.
> *Actual result:* at least one of the workers will get "java.net.SocketTimeoutException:
Read timed out" error.
> *Workaround:* limit HttpClient max connections to MAX_CONNECTIONS-1 and the test will
pass.
> Seems to be some off-by-one bug somewhere in PoolingClientConnectionManager.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message