activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samuel Ueltschi (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMQ-6949) SocketTimeoutException when using HTTP transport connector
Date Mon, 23 Apr 2018 06:46:00 GMT

     [ https://issues.apache.org/jira/browse/AMQ-6949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Samuel Ueltschi updated AMQ-6949:
---------------------------------
     Attachment: HttpClientTransport.java
    Description: 
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&amp;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).

 

 

 

 

 

  was:
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&amp;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}
 


> 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
>            Priority: Major
>         Attachments: HttpClientTransport.java, TestConnect.java, activemq.xml, amqtest.zip
>
>
> 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&amp;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.3#76005)

Mime
View raw message