activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Vijlbrief <tom...@xs4all.nl>
Subject Re: [Spam: 5.0] Memory usage increase after client power failure
Date Sat, 24 Feb 2007 13:04:20 GMT

> transportConnector.  Maybe I am misunderstanding the purpose of the
> transportConnector soTimeout or have specified it incorrectly.
>
> <transportConnector
> uri="tcp://servername:61616?soTimeout=10000?jms.useAsyncSend=true?jms.dispa
>tchAsync=true?jms.prefetchPolicy.all=20?jms.optimizeAcknowledge=false"/>
>

It took quite some time to figure this out, you should use:

uri="tcp://localhost:61616?transport.soTimeout=10000"

This is really not clearly documented. 

You should also experiment with keepAlive: 

tcp://localhost:61616?transport.keepAlive=true

or a combination:

tcp://localhost:61616?transport.soTimeout=10000&amp;transport.keepAlive=true

The signature for setKeepAlive in TcpTransport is Boolean keepAlive (Uppercase 
B instead of boolean) and I couldn't figure out how to set it in the URI. 
Shouldn't all Booleans in TcpTransport be boolean anyway?

I changed the signature to:

public void setKeepAlive(boolean keepAlive)

so that the option is settable.

I think the correct way to approach your problem is the keepAlive option
and NOT the soTimeout option. The keepAlive option should have
the effect that a dead connection is detected. The time is depending
on your OS and its specific settings. See:

http://www.die.net/doc/linux/man/man7/tcp.7.html

if you're using Linux.

Quote:

tcp_keepalive_intvl (integer; default: 75) 
The number of seconds between TCP keep-alive probes. 
tcp_keepalive_probes (integer; default: 9) 
The maximum number of TCP keep-alive probes to send before giving up and 
killing the connection if no response is obtained from the other end. 
tcp_keepalive_time (integer; default: 7200) 
The number of seconds a connection needs to be idle before TCP begins sending 
out keep-alive probes. Keep-alives are only sent when the SO_KEEPALIVE socket 
option is enabled. The default value is 7200 seconds (2 hours). An idle 
connection is terminated after approximately an additional 11 minutes (9 
probes an interval of 75 seconds apart) when keep-alive is enabled.

I suggest setting tcp_keepalive_intvl to 5 and tcp_keepalive_intvl to 3

Anyway, if you want to experiment with soTimeout:
Note that the run() method in TcpTransport is currenty ignoring 
SocketTimeoutException,
try commenting out two lines:
================================================
    public void run() {
        log.trace("TCP consumer thread starting");
        while (!isStopped()) {
            try {
                Object command = readCommand();
                doConsume(command);
            }
//            catch (SocketTimeoutException e) {
//            }
            catch (InterruptedIOException e) {
            }
            catch (IOException e) {
                try {
                    stop();
                }
                catch (Exception e2) {
                    log.warn("Caught while closing: " + e2 + ". Now Closed", 
e2);
                }
                onException(e);
            }
        }
    }
=======================================================

Good luck,

Tom

Mime
View raw message