[rabbitmq-discuss] TCP timeouts

Matthias Radestock matthias at lshift.net
Wed May 7 18:18:16 BST 2008


David,

David.Corcoran at edftrading.com wrote:
> I've run into a problem testing RabbitMQ. My Java clients keep
> disconnecting when using a lot of CPU and the error in the RabbitMQ logs
> is:
> =ERROR REPORT==== 7-May-2008::11:41:44 ===
> error on TCP connection from 127.0.0.1:37299
> {timeout,frame_header}
> 
> I'm using channel.basicGet and I think I've narrowed down the problem. When
> I get a message I process it, then call basicAck once it's done. So the
> code looks like:
> GetResponse basicGet = channel.basicGet(ticket, queueName, false);
>  if (basicGet != null) {
>         process(basicGet);
>         channel.basicAck(basicGet.getEnvelope().getDeliveryTag(), false);
> }
> 
> if process() looks like this:
>             long start = System.currentTimeMillis();
>             while(true) {
>                 long now = System.currentTimeMillis();
>                 if(now - start > 10000) {
>                     break;
>                 }
>             }
> The client will disconnect. If I add a Thread.sleep(0) into the loop it
> will work fine. The sleep 0 just yields. In my real code it doesn't do that
> loop but does do a lot of maths that can take up to about 1 minute so it
> has the same effect of killing the CPU for a while.
> 
> I guess what's happening is that the connection thread isn't getting any
> time to send heartbeats and the server is disconnecting it. Is there a work
> around for this? Can I change the heartbeat?
> 
> A little more information if that helps:
>  - Quad core machine, only using 1 cpu during this test
>  - 4GB Ram
>  - Erlang 5.5.5 (64bit)
>  - Ubunut 64
>  - Rabbit mq 1.3.0-1

That is weird. The application thread that is calling process(...), and 
the connection thread are separate threads. The workload on the former 
should not prevent the latter from sending heartbeats, certainly not on 
a quad-core machine.

Can you post the complete example? Also, what version of the jvm are you 
running?


Matthias.




More information about the rabbitmq-discuss mailing list