Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Server closing channel hangs client in recv #5

Closed
MattiL opened this issue Apr 19, 2012 · 2 comments
Closed

Server closing channel hangs client in recv #5

MattiL opened this issue Apr 19, 2012 · 2 comments

Comments

@MattiL
Copy link

MattiL commented Apr 19, 2012

Server closing the channel hangs the client in wait_frame_inner / recv:
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-April/019361.html
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-April/019572.html

It seems to me that the client does not recognize the server sending an error message about the publish exchange not existing and therefore can get stuck on a channel that does not get any more messages.

I have encountered a possible fault in librabbitmq (rabbitmq-c-fb6fca832fd2). I am trying to use that latest version customized with Perl Net::RabbitMQ on SLES 11 SP 1.

amqp_simple_wait_frame and recv do not respond to messages being published to an exchange after rabbitmqctl stop_app, reset and start_app. That problem appears also with Net::RabbitMQ versions 0.2.2 and 0.2.0.

I got the following state in gdb with recv:

0x00007f38e70b7935 in recv () from /lib64/libpthread.so.0
(gdb) bt
#0 0x00007f38e70b7935 in recv () from /lib64/libpthread.so.0
#1 0x00007f38e5cfba4d in recv (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at /usr/include/bits/socket2.h:45

#2 wait_frame_inner (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at amqp_socket.c:182

#3 0x00007f38e5ce78b9 in internal_recv (RETVAL=0xbf4f68, conn=0xbe1440,

piggyback=0) at RabbitMQ.xs:77

#4 0x00007f38e5ce8566 in XS_Net__RabbitMQ_recv (

my_perl=<value optimized out>, cv=<value optimized out>) at RabbitMQ.xs:424

#5 0x000000000047e115 in Perl_pp_entersub ()
#6 0x0000000000455ad3 in Perl_runops_debug ()
#7 0x000000000047a1af in perl_run ()
#8 0x000000000042172c in main ()

(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x00007f38e70b7935 in recv () from /lib64/libpthread.so.0
(gdb) bt
#0 0x00007f38e70b7935 in recv () from /lib64/libpthread.so.0
#1 0x00007f38e5cfba4d in recv (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at /usr/include/bits/socket2.h:45

#2 wait_frame_inner (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at amqp_socket.c:182

#3 0x00007f38e5ce78b9 in internal_recv (RETVAL=0xbf4f68, conn=0xbe1440,

piggyback=0) at RabbitMQ.xs:77

#4 0x00007f38e5ce8566 in XS_Net__RabbitMQ_recv (

my_perl=<value optimized out>, cv=<value optimized out>) at RabbitMQ.xs:424

#5 0x000000000047e115 in Perl_pp_entersub ()
#6 0x0000000000455ad3 in Perl_runops_debug ()
#7 0x000000000047a1af in perl_run ()
#8 0x000000000042172c in main ()

(gdb) up
#1 0x00007f38e5cfba4d in recv (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at /usr/include/bits/socket2.h:45

45 return __recv_alias (__fd, __buf, __n, __flags);
(gdb) up
#2 wait_frame_inner (__flags=,

__n=<value optimized out>, __buf=<value optimized out>, 
__fd=<value optimized out>) at amqp_socket.c:182

182 res = recv(state->sockfd, state->sock_inbound_buffer.bytes,
(gdb) up
#3 0x00007f38e5ce78b9 in internal_recv (RETVAL=0xbf4f68, conn=0xbe1440,

piggyback=0) at RabbitMQ.xs:77

77 result = amqp_simple_wait_frame(conn, &frame);
(gdb) print conn
$1 = (amqp_connection_state_t) 0xbe1440
(gdb) print *conn
$2 = {frame_pool = {pagesize = 131072, pages = {num_blocks = 5,
blocklist = 0xc5d4f0}, large_blocks = {num_blocks = 0, blocklist = 0x0},
next_page = 0, alloc_block = 0x0, alloc_used = 0}, decoding_pool = {
pagesize = 131072, pages = {num_blocks = 1, blocklist = 0xbf22e0},
large_blocks = {num_blocks = 0, blocklist = 0x0}, next_page = 0,
alloc_block = 0x0, alloc_used = 0}, state = CONNECTION_STATE_IDLE,
channel_max = 0, frame_max = 131072, heartbeat = 0, inbound_buffer = {
len = 131072, bytes = 0x0}, inbound_offset = 0, target_size = 7,
outbound_buffer = {len = 131072, bytes = 0xc67f90}, sockfd = 3,
sock_inbound_buffer = {len = 131072, bytes = 0x7f38e7b57010},
sock_inbound_offset = 79, sock_inbound_limit = 79, first_queued_frame = 0x0,
last_queued_frame = 0x0, most_recent_api_result = {
reply_type = AMQP_RESPONSE_NORMAL, reply = {id = 3932181,
decoded = 0x7f38e7af1038}, library_error = 0}}

@MattiL
Copy link
Author

MattiL commented Apr 23, 2012

I have added a callback to rabbitmq-c for channel close messages in https://github.com/MattiL/Net--RabbitMQ
That way a client can handle channel close messages from the server and not get stuck in recv system call. I would like you to implement a similar feature.

@alanxz
Copy link
Collaborator

alanxz commented May 10, 2012

I've migrated this issue over to alanxz#15. Please continue discussion there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants