[rabbitmq-discuss] socket read timeout in rabbitmq-c

alex chen chen650 at yahoo.com
Thu May 6 00:35:44 BST 2010


We are using rabbitmq-c.  It seems to me most of the functions such as amqp_login and amqp_channel_open call amqp_simple_rpc, which sends the request and waits for response.  There seems to be no way to specify timeout value for waiting the response.  the amqp_socket.c::wait_frame_inner() calls read() and it may block forever if the response is net received.

I am wondering if it can support specifying a time out (e.g. amqp_set_timeout(int timeout)), and add select(timeout) before the read() in wait_frame?  We found in several cases that amqp_channel_open hanged while doing read() in wait_frame_inner().  here is the stack trace:

(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xf7fbc69b in __read_nocancel () from /lib/tls/libpthread.so.0
#2  0xf7fdf3e3 in wait_frame_inner (state=0x8053938, decoded_frame=0xf7732180) at amqp_socket.c:147
#3  0xf7fdf64f in amqp_simple_rpc (state=0x8053938, channel=1, request_id=1310730, expected_reply_ids=0xf77321f8,
decoded_request_method=0xf77321f0) at amqp_socket.c:251
#4  0xf7fdff3b in amqp_channel_open (state=0x8053938, channel=1) at




More information about the rabbitmq-discuss mailing list