[rabbitmq-discuss] TCP timeouts

David.Corcoran at edftrading.com David.Corcoran at edftrading.com
Thu May 8 09:29:04 BST 2008


Hi Matthias,

It looks like you were right about the java version. Running in java
1.5.0.15 doesn't work. Running in java-6-openjdk or java-6 (1.6.0.06) works
fine. I think it's a bug, perhaps related to this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6383015

I've attached the code that displays the problem. Putting back the
Thread.yield() in java 5 makes it work, but obviously isn't a viable
solution.

I guess it's time we upgrade to java 6 ;)

Thanks again for your help,

Dave

(See attached file: TimeoutTest.java)




                                                                           
             Matthias                                                      
             Radestock                                                     
             <matthias at lshift.                                          To 
             net>                      David.Corcoran at edftrading.com       
             Sent by:                                                   cc 
             rabbitmq-discuss-         rabbitmq-discuss at lists.rabbitmq.com 
             bounces at lists.rab                                     Subject 
             bitmq.com                 Re: [rabbitmq-discuss] TCP timeouts 
                                                                           
                                                                           
             07/05/2008 18:18                                              
                                                                           
                                                                           
                                                                           





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.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


*********************************************************************
This communication contains confidential information, some or all of which may be privileged. It is for the intended recipient only and others must not disclose, distribute, copy, print or rely on this communication. If an addressing or transmission error has misdirected this communication, please notify the sender by replying to this e-mail and then delete the e-mail. E-mail sent to EDF Trading may be monitored by the company. Thank you. 
EDF Trading Limited
80 Victoria Street, 3rd Floor, Cardinal Place, London, SW1E 5JL
A Company registered in England No. 4255974. 
Switchboard: 020 7061 4000
EDF Trading Markets Limited is a member of the EDF Trading Limited Group and is authorised and regulated by the Financial Services Authority.
VAT number: GB 735 5479 07
*********************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TimeoutTest.java
Type: application/octet-stream
Size: 1795 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080508/2ab8f6ee/attachment.obj 


More information about the rabbitmq-discuss mailing list