activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMQ-4521) stomp tcp keepalive not working
Date Wed, 08 May 2013 02:03:15 GMT
Erik created AMQ-4521:
-------------------------

             Summary: stomp tcp keepalive not working
                 Key: AMQ-4521
                 URL: https://issues.apache.org/jira/browse/AMQ-4521
             Project: ActiveMQ
          Issue Type: Bug
          Components: stomp
    Affects Versions: 5.8.0, 5.6.0
         Environment: Linux: Ubuntu 12.04.1 LTS (precise)
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
            Reporter: Erik
             Fix For: 5.8.0


keepAlive not working for stomp URLs. Here is the activemq.xml:

{{<transportConnector name="stomp+ssl" uri="stomp+ssl://0.0.0.0:61613?trace=true&amp;soLinger30000&amp;keepAlive=true&amp;soTimeout=44000"/>}}

Running "netstat -tupnco" as root shows java processes without the keepalive timer counting
down. This confirms that tcp keepalive is not working.

However, running activemq under the following strace command seems to indicate tcp keepalive
is being enabled with the setsockopt() system call:

bq.{{strace -o /dev/stdout -f -e setsockopt bin/activemq-admin start  | grep -i setsockopt}}
bq.{{3029  setsockopt(14, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3029  setsockopt(128, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3040  setsockopt(130, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3040  setsockopt(131, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}
bq.{{3040  setsockopt(131, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0}}
bq.{{3044  setsockopt(132, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}
bq.{{3029  setsockopt(133, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3044  setsockopt(133, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}
bq.{{3044  setsockopt(133, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0}}
bq.{{3047  setsockopt(134, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}
bq.{{3044  setsockopt(135, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3029  setsockopt(135, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3029  setsockopt(136, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3029  setsockopt(131, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3057  setsockopt(134, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0}}
bq.{{3057  setsockopt(134, SOL_SOCKET, SO_SNDBUF, [65536], 4) = 0}}
bq.{{3056  setsockopt(133, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0}}
bq.{{3056  setsockopt(133, SOL_SOCKET, SO_SNDBUF, [65536], 4) = 0}}
bq.{{3029  setsockopt(140, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3029  setsockopt(140, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0}}
bq.{{3046  setsockopt(145, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}
bq.{{3046  setsockopt(145, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0}}
bq.{{3078  setsockopt(146, SOL_TCP, TCP_NODELAY, [1], 4) = 0}}

But, again, netstat output does not show keepalives being enabled. netstat shows some java
processes with keepalive, but then they quickly disappear. The remaining long lived listening
and connected sockets do not have keepalive.

netstat -tupnco
{{Active Internet connections (w/o servers)}}
{{Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program
name Timer}}
{{tcp        0      0 10.5.48.17:61613        10.5.48.241:57464       ESTABLISHED 3287/java
       off (0.00/0/0)}}
{{tcp        0      0 10.5.48.17:22           192.168.2.10:1203       ESTABLISHED 1548/sshd:
b [priv] keepalive (3768.50/0/0)}}
{{tcp        0      0 10.5.48.17:61613        169.254.6.55:35975      ESTABLISHED 3287/java
       off (0.00/0/0)}}

In addition, even if keepAlive was being set, this is not really a good solution as implemented
because one cannot set the keepalive options at the socket level, only at the OS system-wide
level. There's no way to set TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL. When I set the
keepalive options at the OS level, all applications are affected. I clearly don't want to
use the same keepalive settings system wide. These three settings should be allowed to set
keepalives only for activemq.

Temporary workaround: use http://libkeepalive.sourceforge.net/

--
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

Mime
View raw message