smallrye / smallrye-reactive-messaging

SmallRye Reactive Messaging
http://www.smallrye.io/smallrye-reactive-messaging/
Apache License 2.0
235 stars 176 forks source link

Unexpected trailing sections: v1_0.delivery_annotations #807

Closed Postremus closed 3 years ago

Postremus commented 3 years ago

Describe the bug

Whenever I send messages, I get a disconnect on the java side. In the rabbit container, I see the exception from below about Unexpected trailing sections.

I am using RabbitMQ 3.8.9, smallrye-reactive-messaging 2.4.0 (in quarkus 1.8.3) using the amqp connector. The rabbitmq-amqp1.0 is enabled in rabbit.

If I do an downgrade to quarkus 1.6.0.Final, it works just fine. I guess this is an regression.

Expected behavior Sending of messages should work.

Actual behavior

rabbitmq_1  | ** Last message in was {'$gen_cast',{frame,{{'v1_0.transfer',{uint,0},{uint,0},{binary,<<0,0,0,1>>},{uint,0},false,undefined,undefined,undefined,undefined,undefined,undefined},<<0,83,113,193,1,0,0,83,114,193,1,0,0,83,115,208,0,0,0,35,0,0,0,7,64,64,161,6,112,114,105,99,101,115,64,64,64,163,16,97,112,112,108,105,99,97,116,105,111,110,47,106,115,111,110,0,83,116,193,1,0,0,83,117,160,47,123,34,112,97,121,108,111,97,100,34,58,56,54,44,34,109,101,116,97,100,97,116,97,34,58,91,93,44,34,97,99,107,34,58,123,125,44,34,110,97,99,107,34,58,123,125,125,0,83,120,193,1,0>>},<0.2066.0>}}
rabbitmq_1  | ** When Server state == {state,<0.2075.0>,<0.2081.0>,32760,<0.2066.0>,<0.2071.0>,{[],[]},{session,0,65535,2147483647,1,65535,65535,0,65535,65535,1,0,{0,nil},{0,nil}}}
rabbitmq_1  | ** Reason for termination == 
rabbitmq_1  | ** {{unexpected_trailing_sections,{{'v1_0.delivery_annotations',[]},<<0,83,114,193,1,0,0,83,115,208,0,0,0,35,0,0,0,7,64,64,161,6,112,114,105,99,101,115,64,64,64,163,16,97,112,112,108,105,99,97,116,105,111,110,47,106,115,111,110,0,83,116,193,1,0,0,83,117,160,47,123,34,112,97,121,108,111,97,100,34,58,56,54,44,34,109,101,116,97,100,97,116,97,34,58,91,93,44,34,97,99,107,34,58,123,125,44,34,110,97,99,107,34,58,123,125,125,0,83,120,193,1,0>>}},[{rabbit_amqp1_0_message,assemble,4,[{file,"src/rabbit_amqp1_0_message.erl"},{line,104}]},{rabbit_amqp1_0_message,assemble,1,[{file,"src/rabbit_amqp1_0_message.erl"},{line,21}]},{rabbit_amqp1_0_incoming_link,transfer,4,[{file,"src/rabbit_amqp1_0_incoming_link.erl"},{line,138}]},{rabbit_amqp1_0_session_process,handle_control,2,[{file,"src/rabbit_amqp1_0_session_process.erl"},{line,253}]},{rabbit_amqp1_0_session_process,handle_cast,2,[{file,"src/rabbit_amqp1_0_session_process.erl"},{line,173}]},{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1067}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}
rabbitmq_1  | 2020-10-14 20:08:44.012 [info] <0.2072.0> [{initial_call,{rabbit_amqp1_0_session_process,init,['Argument__1']}},{pid,<0.2072.0>},{registered_name,[]},{error_info,{exit,{{unexpected_trailing_sections,{{'v1_0.delivery_annotations',[]},<<0,83,114,193,1,0,0,83,115,208,0,0,0,35,0,0,0,7,64,64,161,6,112,114,105,99,101,115,64,64,64,163,16,97,112,112,108,105,99,97,116,105,111,110,47,106,115,111,110,0,83,116,193,1,0,0,83,117,160,47,123,34,112,97,121,108,111,97,100,34,58,56,54,44,34,109,101,116,97,100,97,116,97,34,58,91,93,44,34,97,99,107,34,58,123,125,44,34,110,97,99,107,34,58,123,125,125,0,83,120,193,1,0>>}},[{rabbit_amqp1_0_message,assemble,4,[{file,"src/rabbit_amqp1_0_message.erl"},{line,104}]},{rabbit_amqp1_0_message,assemble,1,[{file,"src/rabbit_amqp1_0_message.erl"},{line,21}]},{rabbit_amqp1_0_incoming_link,transfer,4,[{file,"src/rabbit_amqp1_0_incoming_link.erl"},{line,138}]},{rabbit_amqp1_0_session_process,handle_control,2,[{file,"src/rabbit_amqp1_0_session_process.erl"},{line,253}]},{rabbit_amqp1_0_session_process,handle_cast,2,[{file,"src/rabbit_amqp1_0_session_process.erl"},{line,173}]},{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1067}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]},[{gen_server2,terminate,3,[{file,"src/gen_server2.erl"},{line,1183}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}},{ancestors,[<0.2070.0>,<0.2067.0>,<0.2065.0>,<0.2064.0>,<0.817.0>,<0.816.0>,<0.815.0>,rabbit_sup,<0.272.0>]},{message_queue_len,1},{messages,[{'DOWN',#Ref<0.1957472466.783024131.79755>,process,<0.2081.0>,normal}]},{links,[<0.2070.0>]},{dictionary,[{{in,{uint,0}},{incoming_link,{utf8,<<"generated-price">>},<<>>,<<"prices">>,undefined,0,undefined,{ubyte,0},32768,[],{set,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[<<"prices">>],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}}},{credit_flow_default_credit,{400,200}},{{credit_to,<0.2066.0>},197},{gen_server_call_timeout,60000}]},{trap_exit,true},{status,running},{heap_size,1598},{stack_size,28},{reductions,5509}], []
rabbitmq_1  | 2020-10-14 20:08:44.012 [error] <0.2072.0> CRASH REPORT Process <0.2072.0> with 0 neighbours exited with reason: {unexpected_trailing_sections,{{'v1_0.delivery_annotations',[]},<<0,83,114,193,1,0,0,83,115,208,0,0,0,35,0,0,0,7,64,64,161,6,112,114,105,99,101,115,64,64,64,163,16,97,112,112,108,105,99,97,116,105,111,110,47,106,115,111,110,0,83,116,193,1,0,0,83,117,160,47,123,34,112,97,121,108,111,97,100,34,58,56,54,44,34,109,101,116,97,100,97,116,97,34,58,91,93,44,34,97,99,107,34,58,123,125,44,34,110,97,99,107,34,58,123,125,125,0,83,120,193,1,0>>}} in rabbit_amqp1_0_message:assemble/4 line 104 in gen_server2:terminate/3 line 1183
rabbitmq_1  | 2020-10-14 20:08:44.012 [error] <0.2070.0> Supervisor {<0.2070.0>,rabbit_amqp1_0_session_sup} had child channel started with rabbit_amqp1_0_session_process:start_link({0,<0.2066.0>,<0.2071.0>,{user,<<"guest">>,[administrator],[{rabbit_auth_backend_internal,none}]},...}) at <0.2072.0> exit with reason {unexpected_trailing_sections,{{'v1_0.delivery_annotations',[]},<<0,83,114,193,1,0,0,83,115,208,0,0,0,35,0,0,0,7,64,64,161,6,112,114,105,99,101,115,64,64,64,163,16,97,112,112,108,105,99,97,116,105,111,110,47,106,115,111,110,0,83,116,193,1,0,0,83,117,160,47,123,34,112,97,121,108,111,97,100,34,58,56,54,44,34,109,101,116,97,100,97,116,97,34,58,91,93,44,34,97,99,107,34,58,123,125,44,34,110,97,99,107,34,58,123,125,125,0,83,120,193,1,0>>}} in rabbit_amqp1_0_message:assemble/4 line 104 in context child_terminated

To Reproduce

Steps to reproduce the behavior:

  1. Download this reproducer: amqp-quickstart.zip
  2. In the first terminal: docker-compose up, this will start the rabbitmq
  3. In the second terminal: mvn quarkus:dev
  4. Every 3 seconds, you should see an disconnect in the maven terminal, and the exception from above in the docker terminal
  5. Now, downgrade the project to quarkus 1.6.0.Final (in the pom.xml), stop the rabbitmq. Repeat steps 2 and 3. If you now go to http://localhost:8080/prices.html you will see that the price updates every 3 seconds.

Configuration

quarkus.log.console.level=DEBUG

# Configures the AMQP broker credentials.
amqp-username=guest
amqp-password=guest

# Configure the AMQP connector to write to the `prices`  address
mp.messaging.outgoing.generated-price.connector=smallrye-amqp
mp.messaging.outgoing.generated-price.address=prices
mp.messaging.outgoing.generated-price.use-anonymous-sender=false

# Configure the AMQP connector to read from the `prices` queue
mp.messaging.incoming.prices.connector=smallrye-amqp
mp.messaging.incoming.prices.durable=false

Environment (please complete the following information):

cescoffier commented 3 years ago

First, I would like to thank you about the reproducer! Finally, an easy reproducer using RabbitMQ! As a consequence, I will able to pinpoint the issue and got it working. You are facing #806. Fixing it right now.

gemmellr commented 3 years ago

Note that there is nothing invalid at all about sending a delivery-annotations section, #806 just points out that it is superfluous if its empty. A peer failing to handle it would be in error.

cescoffier commented 3 years ago

Yeah, I read the spec again and nothing is said. Buy your arguments are valid and as a side effect it fixes the RabbitMQ issue (don't ask :-D )