{"action":"created","issue":{"url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/458","repository_url":"https://api.github.com/repos/alanxz/rabbitmq-c","labels_url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/458/labels{/name}","comments_url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/458/comments","events_url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/458/events","html_url":"https://github.com/alanxz/rabbitmq-c/issues/458","id":273083380,"number":458,"title":"segfault when trying to close channel/connection when we receive AMQP_STATUS_BAD_AMQP_DATA","user":{"login":"reddysrikesh","id":643264,"avatar_url":"https://avatars3.githubusercontent.com/u/643264?v=4","gravatar_id":"","url":"https://api.github.com/users/reddysrikesh","html_url":"https://github.com/reddysrikesh","followers_url":"https://api.github.com/users/reddysrikesh/followers","following_url":"https://api.github.com/users/reddysrikesh/following{/other_user}","gists_url":"https://api.github.com/users/reddysrikesh/gists{/gist_id}","starred_url":"https://api.github.com/users/reddysrikesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddysrikesh/subscriptions","organizations_url":"https://api.github.com/users/reddysrikesh/orgs","repos_url":"https://api.github.com/users/reddysrikesh/repos","events_url":"https://api.github.com/users/reddysrikesh/events{/privacy}","received_events_url":"https://api.github.com/users/reddysrikesh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-11-10T22:53:34Z","updated_at":"2017-11-11T14:36:12Z","closed_at":null,"author_association":"NONE","body":"Our program seg faulted with three different backtraces when we are trying to close channel in this case(AMQP_STATUS_BAD_AMQP_DATA). Looks like amqp_channel_close() method is trying to read data by calling consume_one_frame(). state->inbound_buffer.bytes is pointing to garbage which is causing the crash.  We also tried skipping amqp_channel_close and just calling amqp_connection_close instead. amqp_connection_close is also invoking consume_one_frame() (last bt)\r\n\r\n#0 0x00007ffff58df45d in amqp_socket_recv (self=0x622d376531312d38, buf=0x3065333133646164, len=7076905863073654374, flags=0)\r\nat tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:216\r\n#1 0x00007ffff58e0205 in recv_with_timeout (state=0x7fff680d0b40, timeout=...) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:701\r\n#2 0x00007ffff58e05a2 in wait_frame_inner (state=0x7fff680d0b40, decoded_frame=0x7fff637fc5b0, timeout=0x0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:836\r\n#3 0x00007ffff58e0c89 in amqp_simple_rpc (state=0x7fff680d0b40, channel=1, request_id=1310760, expected_reply_ids=0x7fff637fc670, decoded_request_method=0x7fff637fc650)\r\nat tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:1062\r\n#4 0x00007ffff58dd65a in amqp_channel_close (state=0x7fff680d0b40, channel=1, code=200) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_api.c:281\r\n#5 0x0000000000595405 in RabbitMQClient::RMQDisconnect (this=0x7fff7008a9a0) at RabbitMQClient.cpp:314\r\n\r\n#1 0x00007ffff58de072 in consume_data (state=0x7fff70089d90, received_data=0x7fff637fc458) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_connection.c:236\r\n#2 0x00007ffff58de132 in amqp_handle_input (state=0x7fff70089d90, received_data=..., decoded_frame=0x7fff637fc5b0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_connection.c:264\r\n#3 0x00007ffff58e0191 in consume_one_frame (state=0x7fff70089d90, decoded_frame=0x7fff637fc5b0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:685\r\n#4 0x00007ffff58e04a8 in wait_frame_inner (state=0x7fff70089d90, decoded_frame=0x7fff637fc5b0, timeout=0x0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:799\r\n#5 0x00007ffff58e0c89 in amqp_simple_rpc (state=0x7fff70089d90, channel=1, request_id=1310760, expected_reply_ids=0x7fff637fc670, decoded_request_method=0x7fff637fc650)\r\nat tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:1062\r\n#6 0x00007ffff58dd65a in amqp_channel_close (state=0x7fff70089d90, channel=1, code=200) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_api.c:281\r\n#7 0x0000000000595405 in RabbitMQClient::RMQDisconnect (this=0x7fff7008a9a0) at RabbitMQClient.cpp:316\r\n\r\n#0 0x00007ffff58dda41 in amqp_d16 (data=0x32726573756f6373, offset=1) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_private.h:337\r\n#1 0x00007ffff58de245 in amqp_handle_input (state=0x7fff681fdbc0, received_data=..., decoded_frame=0x7fff637fc5c0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_connection.c:301\r\n#2 0x00007ffff58e0191 in consume_one_frame (state=0x7fff681fdbc0, decoded_frame=0x7fff637fc5c0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:685\r\n#3 0x00007ffff58e04a8 in wait_frame_inner (state=0x7fff681fdbc0, decoded_frame=0x7fff637fc5c0, timeout=0x0) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:799\r\n#4 0x00007ffff58e0c89 in amqp_simple_rpc (state=0x7fff681fdbc0, channel=1, request_id=1310760, expected_reply_ids=0x7fff637fc680, decoded_request_method=0x7fff637fc660)\r\nat tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:1062\r\n#5 0x00007ffff58dd65a in amqp_channel_close (state=0x7fff681fdbc0, channel=1, code=200) at tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_api.c:281\r\n\r\n\r\n#0  0x00007ffff58dda41 in amqp_d16 (data=0x1084412031002d8, offset=1) at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_private.h:337\r\n#1  0x00007ffff58de245 in amqp_handle_input (state=0x7fff6810a8c0, received_data=..., decoded_frame=0x7fff637fc5a0) at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_connection.c:301\r\n#2  0x00007ffff58e0191 in consume_one_frame (state=0x7fff6810a8c0, decoded_frame=0x7fff637fc5a0) at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:685\r\n#3  0x00007ffff58e04a8 in wait_frame_inner (state=0x7fff6810a8c0, decoded_frame=0x7fff637fc5a0, timeout=0x0) at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:799\r\n#4  0x00007ffff58e0c89 in amqp_simple_rpc (state=0x7fff6810a8c0, channel=0, request_id=655410, expected_reply_ids=0x7fff637fc660, decoded_request_method=0x7fff637fc640)\r\n    at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_socket.c:1062\r\n#5  0x00007ffff58dd6e5 in amqp_connection_close (state=0x7fff6810a8c0, code=200) at/tmp/rabbitmq-c-0.7.0/librabbitmq/amqp_api.c:298"},"comment":{"url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/comments/343669482","html_url":"https://github.com/alanxz/rabbitmq-c/issues/458#issuecomment-343669482","issue_url":"https://api.github.com/repos/alanxz/rabbitmq-c/issues/458","id":343669482,"user":{"login":"reddysrikesh","id":643264,"avatar_url":"https://avatars3.githubusercontent.com/u/643264?v=4","gravatar_id":"","url":"https://api.github.com/users/reddysrikesh","html_url":"https://github.com/reddysrikesh","followers_url":"https://api.github.com/users/reddysrikesh/followers","following_url":"https://api.github.com/users/reddysrikesh/following{/other_user}","gists_url":"https://api.github.com/users/reddysrikesh/gists{/gist_id}","starred_url":"https://api.github.com/users/reddysrikesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddysrikesh/subscriptions","organizations_url":"https://api.github.com/users/reddysrikesh/orgs","repos_url":"https://api.github.com/users/reddysrikesh/repos","events_url":"https://api.github.com/users/reddysrikesh/events{/privacy}","received_events_url":"https://api.github.com/users/reddysrikesh/received_events","type":"User","site_admin":false},"created_at":"2017-11-11T14:36:12Z","updated_at":"2017-11-11T14:36:12Z","author_association":"NONE","body":"we are running into same problem with latest from master as well. Here are backtraces\r\n\r\n#0  0x00007ffff58dd3c0 in amqp_d16 (data=0x637461633a333767)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_private.h:274\r\n#1  0x00007ffff58ddd5d in amqp_handle_input (state=0x7fff680fa540, received_data=..., decoded_frame=0x7fff637fc540)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_connection.c:309\r\n#2  0x00007ffff58dfd5a in consume_one_frame (state=0x7fff680fa540, decoded_frame=0x7fff637fc540)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:697\r\n#3  0x00007ffff58e004f in wait_frame_inner (state=0x7fff680fa540, decoded_frame=0x7fff637fc540, timeout_deadline=...)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:802\r\n#4  0x00007ffff58e08c2 in simple_rpc_inner (state=0x7fff680fa540, channel=1, request_id=1310760, expected_reply_ids=0x7fff637fc660, \r\n    decoded_request_method=0x7fff637fc640, deadline=...)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:1086\r\n#5  0x00007ffff58e0b48 in amqp_simple_rpc (state=0x7fff680fa540, channel=1, request_id=1310760, expected_reply_ids=0x7fff637fc660, \r\n    decoded_request_method=0x7fff637fc640) at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:1165\r\n#6  0x00007ffff58dcf41 in amqp_channel_close (state=0x7fff680fa540, channel=1, code=200)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_api.c:285\r\n\r\n\r\n\r\n#0  0x00007ffff58def3b in amqp_socket_recv (self=0x31465265656e7671, buf=0x676e, len=3850914583825052782, flags=0)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:138\r\n#1  0x00007ffff58dfdce in recv_with_timeout (state=0x7fff68164c80, timeout=...)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:713\r\n#2  0x00007ffff58e0148 in wait_frame_inner (state=0x7fff68164c80, decoded_frame=0x7fff637fc540, timeout_deadline=...)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:839\r\n#3  0x00007ffff58e08c2 in simple_rpc_inner (state=0x7fff68164c80, channel=0, request_id=655410, expected_reply_ids=0x7fff637fc660, \r\n    decoded_request_method=0x7fff637fc640, deadline=...)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:1086\r\n#4  0x00007ffff58e0b48 in amqp_simple_rpc (state=0x7fff68164c80, channel=0, request_id=655410, expected_reply_ids=0x7fff637fc660, \r\n    decoded_request_method=0x7fff637fc640) at /home/srmandal/src/6_2_3_STAGING/src/rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_socket.c:1165\r\n#5  0x00007ffff58dcfee in amqp_connection_close (state=0x7fff68164c80, code=200)\r\n    at /rabbitmq-c-master/rabbitmq-c-master/librabbitmq/amqp_api.c:306\r\n\r\n"}}
{"actor":{"display_login":"reddysrikesh"}}