[
https://issues.apache.org/jira/browse/AMQ-6949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16893661#comment-16893661
]
ASF subversion and git services commented on AMQ-6949:
------------------------------------------------------
Commit 32ddadc7abe714dd40a0603b53f5709c5eafcaa4 in activemq's branch
refs/heads/master from Jean-Baptiste Onofré
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=32ddadc ]
Merge pull request #362 from suem/master
AMQ-6949: SocketTimeoutException when using HTTP transport connector
> SocketTimeoutException when using HTTP transport connector
> ----------------------------------------------------------
>
> Key: AMQ-6949
> URL: https://issues.apache.org/jira/browse/AMQ-6949
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.15.3
> Reporter: Samuel Ueltschi
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 5.16.0, 5.15.10
>
> Attachments: HttpClientTransport.java, TestConnect.java,
> activemq.xml, amqtest.zip
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Java clients that connect to the ActiveMQ broker over the HTTP transport
> connector loose the conection after 30 seconds with the following exception:
>
> {code:java}
> WARN | Transport (http://localhost:8866) failed , attempting to automatically
> reconnect: {}
> java.io.IOException: Failed to perform GET on: http://localhost:8866 Reason:
> Read timed out
> at
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:34)
> at
> org.apache.activemq.transport.http.HttpClientTransport.run(HttpClientTransport.java:208)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
> at java.net.SocketInputStream.read(SocketInputStream.java:171)
> at java.net.SocketInputStream.read(SocketInputStream.java:141)
> at
> org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:158)
> at
> org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:82)
> at
> org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:271)
> at
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at
> org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
> at
> org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257)
> at
> org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:207)
> at
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at
> org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:684)
> at
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
> at
> org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
> at
> org.apache.activemq.transport.http.HttpClientTransport.run(HttpClientTransport.java:180)
> ... 1 more
>
> {code}
>
> This happens on the default 5.15.3 distribution on Windows and on Ubuntu with
> the following transport connector:
>
> {code:java}
> <transportConnector name="http"
> uri="http://0.0.0.0:8866?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>{code}
>
> There are no errors in the borker log that could explain the problem.
>
> This is the sample program that I used:
>
> {code:java}
> import javax.jms.Connection;
> import javax.jms.JMSException;
> import org.apache.activemq.ActiveMQConnectionFactory;
> public class TestConnect {
> public static void main(String[] args) throws JMSException {
> System.out.println("Connecting:");
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("failover:(http://localhost:8866)?randomize=false&jms.prefetchPolicy.queuePrefetch=1");
> Connection connection = connectionFactory.createConnection("admin", "admin");
> connection.start();
> }
> }{code}
>
> NOTE:
>
> In the meantime I found the cause for the problem. A default socket timeout
> of 30 secods for the HTTP client was introduced with the following ticket:
> https://issues.apache.org/jira/browse/AMQ-6397
> This timeout somewhow seems to conflict with the keep alive requests that
> stays open for arround 30 seconds. I increased the default timeout to 90
> seconds and this seems to resolve the problem (see attached version of
> HttpClientTransport.java).
>
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)