RabbitMQ/AMQP channel/connection is not open - rabbitmq

in our solution (LoRa WAN - Chirpstack application server and network server) we use RabbitMQ server. Frames are transported with use MQTT and AMQP depends on device. In last 2 months 2 times we noticed errors with AMQP.
To fix this we had to restart chirpstack-application-server. But in production it is not possible to always fix it in these way. Could you help me?
I saw that in v3.8.1 * Fix AMQP re-connect issue.
… but I am not sure that this bug was about same
network-server: 3.8.0
application-server: 3.9.0
RabbitMQ: 3.8.2 + Erlang 22.0.7
Output from journalctl:
May 17 11:24:19 loranet-srv-01.emitel.local chirpstack-application-server[32693]: time=“2021-05-17T11:24:19+02:00” level=error msg=“integration/multi: integration error” ctx_id=3c2a7651-03f0-4f34-9ac5-bbeaefce92f0 error=“publish event error: Exception (504) Reason: “channel/connection is not open”” integration="*amqp.Integration"
logs from RabbitMQ crash log:
2021-06-03 03:59:06.403 [info] <0.25055.366> connection <0.25055.366> (127.0.0.1:59682 → 127.0.0.1:5672): user ‘logstash’ authenticated and granted access to vhost ‘/’
2021-06-03 03:59:06.409 [info] <0.24970.366> connection <0.24970.366> (127.0.0.1:59684 → 127.0.0.1:5672): user ‘logstash’ authenticated and granted access to vhost ‘/’
2021-06-03 04:01:17.436 [warning] <0.32299.304> closing AMQP connection <0.32299.304> (10.93.0.1:60538 → 10.93.0.2:5672, vhost: ‘/’, user: ‘chirpstack_as’):
client unexpectedly closed TCP connection
2021-06-03 04:01:18.517 [info] <0.25425.366> MQTT vhost picked using plugin configuration or default
2021-06-03 04:01:18.711 [warning] <0.24203.212> MQTT disconnecting client “172.20.102.1:60372 → 10.93.0.2:1883” with duplicate id ‘logger-1334’
2021-06-03 04:01:18.712 [info] <0.25425.366> accepting MQTT connection <0.25425.366> (172.20.102.1:51255 → 10.93.0.2:1883, client id: logger-1334)
2021-06-03 04:01:24.927 [info] <0.25471.366> MQTT vhost picked using plugin configuration or default
2021-06-03 04:01:26.472 [warning] <0.24249.212> MQTT disconnecting client “172.20.102.1:60371 → 10.93.0.2:1883” with duplicate id ‘logger-2755’
2021-06-03 04:01:26.474 [info] <0.25471.366> accepting MQTT connection <0.25471.366> (172.20.102.1:51297 → 10.93.0.2:1883, client id: logger-2755)
2021-06-03 04:01:30.096 [info] <0.24814.366> MQTT vhost picked using plugin configuration or default
2021-06-03 04:01:31.290 [error] <0.32645.304> MQTT: a socket write failed, the socket might already be closed
2021-06-03 04:01:31.290 [info] <0.32645.304> MQTT connection “10.93.0.1:44382 → 10.93.0.2:1883” will terminate because peer closed TCP connection
2021-06-03 04:01:35.104 [error] <0.24814.366> MQTT cannot accept a connection: client ID registration timed out
2021-06-03 04:01:35.104 [error] <0.24814.366> MQTT cannot accept connection 10.93.0.1:35330 → 10.93.0.2:1883 due to an internal error or unavailable component
2021-06-03 04:01:36.291 [error] <0.32645.304> ** Generic server <0.32645.304> terminating
** Last message in was {tcp_closed,#Port<0.1814243>}
** When Server state == {state,#Port<0.1814243>,“10.93.0.1:44382 → 10.93.0.2:1883”,true,undefined,true,running,{none,<0.32296.304>},<0.32638.304>,false,none,{proc_state,#Port<0.1814243>,#{“application/+/device/+/tx” => [0]},{<<“amq.ctag
-YOowwvGDd4Gio7wHkLEpDQ”>>,undefined},{0,nil},{0,nil},undefined,1,“AckMrCeAAx2bHcmZcnfOzg”,true,undefined,{<0.32618.304>,undefined},<0.32622.304>,<<“amq.topic”>>,{amqp_adapter_info,{0,0,0,0,0,65535,2653,2},1883,{0,0,0,0,0,65535,2653,1},4
4382,<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,{‘MQTT’,“N/A”},[{variable_map,#{<<“client_id”>> => <<“AckMrCeAAx2bHcmZcnfOzg”>>}},{channels,1},{channel_max,1},{frame_max,0},{client_properties,[{<<“product”>>,longstr,<<“MQTT client”>>},{clie
nt_id,longstr,<<“AckMrCeAAx2bHcmZcnfOzg”>>}]},{ssl,false}]},none,<0.530.0>,{auth_state,<<“chirpstack_as”>>,{user,<<“chirpstack_as”>>,[‘Chirpstack’],[{rabbit_auth_backend_internal,none}]},<<"/">>},#Fun<rabbit_mqtt_processor.0.50925783>,{0
,0,0,0,0,65535,2653,1},#Fun<rabbit_mqtt_util.4.100928214>,#Fun<rabbit_mqtt_util.5.100928214>},<0.32622.304>,{state,fine,5000,#Ref<0.2613465786.3301179395.25474>}}
** Reason for termination ==
** {{badmatch,{timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}}},[{rabbit_mqtt_processor,close_connection,1,[{file,“src/rabbit_mqtt_processor.erl”},{line,900}]},{rabbit_mqtt_reader,do_terminate,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,24
2}]},{gen_server2,terminate,3,[{file,“src/gen_server2.erl”},{line,1169}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,259}]}]}
** In ‘terminate’ callback with reason ==
** {shutdown,conn_closed}
2021-06-03 04:01:36.291 [error] <0.32645.304> CRASH REPORT Process <0.32645.304> with 1 neighbours exited with reason: no match of right hand value {timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}} in rabbit_mqtt_processor:close_connection/1
line 900 in gen_server2:terminate/3 line 1172
2021-06-03 04:01:36.292 [error] <0.32621.304> Supervisor {<0.32621.304>,amqp_channel_sup} had child channel started with amqp_channel:start_link(direct, <0.32622.304>, 1, <0.32619.304>, {<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,1}) at <0.
32618.304> exit with reason no match of right hand value {timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}} in rabbit_mqtt_processor:close_connection/1 line 900 in context child_terminated
2021-06-03 04:01:36.292 [error] <0.32640.304> Supervisor {<0.32640.304>,rabbit_mqtt_connection_sup} had child rabbit_mqtt_reader started with rabbit_mqtt_reader:start_link(<0.32638.304>, {acceptor,{0,0,0,0,0,0,0,0},1883}) at <0.32645.304
exit with reason no match of right hand value {timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}} in rabbit_mqtt_processor:close_connection/1 line 900 in context child_terminated
2021-06-03 04:01:36.292 [error] <0.32621.304> Supervisor {<0.32621.304>,amqp_channel_sup} had child channel started with amqp_channel:start_link(direct, <0.32622.304>, 1, <0.32619.304>, {<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,1}) at <0.
32618.304> exit with reason reached_max_restart_intensity in context shutdown
2021-06-03 04:01:36.292 [error] <0.32640.304> Supervisor {<0.32640.304>,rabbit_mqtt_connection_sup} had child rabbit_mqtt_reader started with rabbit_mqtt_reader:start_link(<0.32638.304>, {acceptor,{0,0,0,0,0,0,0,0},1883}) at <0.32645.304
exit with reason reached_max_restart_intensity in context shutdown
2021-06-03 04:01:36.292 [error] <0.32622.304> ** Generic server <0.32622.304> terminating
** Last message in was {‘EXIT’,<0.32645.304>,{{badmatch,{timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}}},[{rabbit_mqtt_processor,close_connection,1,[{file,“src/rabbit_mqtt_processor.erl”},{line,900}]},{rabbit_mqtt_reader,do_terminate,2,[{f
ile,“src/rabbit_mqtt_reader.erl”},{line,242}]},{gen_server2,terminate,3,[{file,“src/gen_server2.erl”},{line,1169}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,259}]}]}}
** When Server state == {state,amqp_direct_connection,{state,‘rabbit#loraapp-srv-01’,{user,<<“chirpstack_as”>>,[‘Chirpstack’],[{rabbit_auth_backend_internal,none}]},<<"/">>,{amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoY
Fhn9qAYI+ygy5qch5P7abl3ORsRMBTw4JnorNUjeMKW”>>,<<"/">>,‘rabbit#loraapp-srv-01’,{amqp_adapter_info,{0,0,0,0,0,65535,2653,2},1883,{0,0,0,0,0,65535,2653,1},44382,<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,{‘MQTT’,“3.1.1”},[{variable_map,#{<<“c
lient_id”>> => <<“AckMrCeAAx2bHcmZcnfOzg”>>}},{channels,1},{channel_max,1},{frame_max,0},{client_properties,[{<<“product”>>,longstr,<<“MQTT client”>>},{client_id,longstr,<<“AckMrCeAAx2bHcmZcnfOzg”>>}]},{ssl,false}]},[]},{amqp_adapter_inf
o,{0,0,0,0,0,65535,2653,2},1883,{0,0,0,0,0,65535,2653,1},44382,<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,{‘MQTT’,“3.1.1”},[{variable_map,#{<<“client_id”>> => <<“AckMrCeAAx2bHcmZcnfOzg”>>}},{channels,1},{channel_max,1},{frame_max,0},{client
_properties,[{<<“product”>>,longstr,<<“MQTT client”>>},{client_id,longstr,<<“AckMrCeAAx2bHcmZcnfOzg”>>}]},{ssl,false}]},<0.32624.304>,undefined,1621256199087},<0.32637.304>,{amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoY
Fhn9qAYI+ygy5qch5P7abl3ORsRMBTw4JnorNUjeMKW”>>,<<"/">>,‘rabbit#loraapp-srv-01’,{amqp_adapter_info,{0,0,0,0,0,65535,2653,2},1883,{0,0,0,0,0,65535,2653,1},44382,<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,{‘MQTT’,“3.1.1”},[{variable_map,#{<<“c
lient_id”>> => <<“AckMrCeAAx2bHcmZcnfOzg”>>}},{channels,1},{channel_max,1},{frame_max,0},{client_properties,[{<<“product”>>,longstr,<<“MQTT client”>>},{client_id,longstr,<<“AckMrCeAAx2bHcmZcnfOzg”>>}]},{ssl,false}]},[]},0,[{<<“capabilities”>>,table,[{<<“publisher_confirms”>>,bool,true},{<<“exchange_exchange_bindings”>>,bool,true},…]},…],…}
** Reason for termination ==
** “stopping because dependent process <0.32645.304> died: {{badmatch,\n {timeout,\n {mqtt_node,\n ‘rabbit#loraapp-srv-01’}}},\n [{rabbit_mqtt_processor,\n close_connection,1,\n [{file,\n “src/rabbit_mqtt_processor.erl”},\n {line,900}]},\n {rabbit_mqtt_reader,\n do_terminate,2,\n [{file,\n “src/rabbit_mqtt_reader.erl”},\n {line,242}]},\n {gen_server2,\n terminate,3,\n [{file,\n “src/gen_server2.erl”},\n {line,1169}]},\n {proc_lib,wake_up,3,\n [{file,\n “proc_lib.erl”},\n {line,25…”
2021-06-03 04:01:36.293 [error] <0.32622.304> CRASH REPORT Process <0.32622.304> with 0 neighbours exited with reason: “stopping because dependent process <0.32645.304> died: {{badmatch,\n {timeout,\n {mqtt_node,\n ‘rabbit#loraapp-srv-01’}}},\n [{rabbit_mqtt_processor,\n close_connection,1,\n …” in gen_server:handle_common_reply/8 line 751
2021-06-03 04:01:36.293 [error] <0.32641.304> Supervisor {<0.32641.304>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.32651.304>, {amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoYFhn9qAYI+ygy5qch5P7abl3ORsRMBTw4Jn…”>>,…}) at <0.32622.304> exit with reason “stopping because dependent process <0.32645.304> died: {{badmatch,\n {timeout,\n {mqtt_node,\n ‘rabbit#loraapp-srv-01’}}},\n [{rabbit_mqtt_processor,\n close_connection,1,\n …” in context child_terminated
2021-06-03 04:01:36.293 [error] <0.32641.304> Supervisor {<0.32641.304>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.32651.304>, {amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoYFhn9qAYI+ygy5qch5P7abl3ORsRMBTw4Jn…”>>,…}) at <0.32622.304> exit with reason reached_max_restart_intensity in context shutdown
2021-06-03 04:01:36.293 [error] <0.295.305> ** Generic server <0.295.305> terminating
** Last message in was {‘EXIT’,<0.32618.304>,{{badmatch,{timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}}},[{rabbit_mqtt_processor,close_connection,1,[{file,“src/rabbit_mqtt_processor.erl”},{line,900}]},{rabbit_mqtt_reader,do_terminate,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,242}]},{gen_server2,terminate,3,[{file,“src/gen_server2.erl”},{line,1169}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,259}]}]}}
** When Server state == {ch,{conf,running,rabbit_framing_amqp_0_9_1,1,<0.32618.304>,<0.32618.304>,<0.32622.304>,<<“10.93.0.1:44382 → 10.93.0.2:1883”>>,undefined,{user,<<“chirpstack_as”>>,[‘Chirpstack’],[{rabbit_auth_backend_internal,none}]},<<"/">>,<<“mqtt-subscription-AckMrCeAAx2bHcmZcnfOzgqos0”>>,<0.32624.304>,[{<<“publisher_confirms”>>,bool,true},{<<“exchange_exchange_bindings”>>,bool,true},{<<“basic.nack”>>,bool,true},{<<“consumer_cancel_notify”>>,bool,true},{<<“connection.blocked”>>,bool,true},{<<“authentication_failure_close”>>,bool,true}],none,10,134217728,undefined,#{<<“client_id”>> => <<“AckMrCeAAx2bHcmZcnfOzg”>>}},{lstate,<0.289.305>,false},none,1,{0,{[],[]}},#{<0.458.0> => {resource,<<"/">>,queue,<<“mqtt-subscription-fe80:1:3:26002:1:1:1:27qos1”>>},<0.24213.212> => {resource,<<"/">>,queue,<<“mqtt-subscription-logger-2755qos0”>>},<0.24242.212> => {resource,<<"/">>,queue,<<“mqtt-subscription-logger-1422qos0”>>},<0.32291.304> => {resource,<<"/">>,queue,<<“mqtt-subscription-AckMrCeAAx2bHcmZcnfOzgqos0”>>},<0.6870.353> => {resource,<<"/">>,queue,<<“mqtt-subscription-mqtt_15e1c9e9.577696qos1”>>}},{state,#{<0.458.0> => #Ref<0.2613465786.3254779908.20375>,<0.24213.212> => #Ref<0.2613465786.3479699457.204624>,<0.24242.212> => #Ref<0.2613465786.3479699457.204623>,<0.32291.304> => #Ref<0.2613465786.3479699457.202162>,<0.6870.353> => #Ref<0.2613465786.3520331777.196060>},erlang},#{<<“amq.ctag-YOowwvGDd4Gio7wHkLEpDQ”>> => {{amqqueue,{resource,<<"/">>,queue,<<“mqtt-subscription-AckMrCeAAx2bHcmZcnfOzgqos0”>>},false,true,none,[],<0.32291.304>,[],[],[],undefined,undefined,[],[],live,0,[],<<"/">>,#{user => <<“chirpstack_as”>>},rabbit_classic_queue,#{}},{true,10,false,[]}}},#{<0.32291.304> => {1,{<<“amq.ctag-YOowwvGDd4Gio7wHkLEpDQ”>>,…}}},…}
** Reason for termination ==
** {{badmatch,{timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}}},[{rabbit_mqtt_processor,close_connection,1,[{file,“src/rabbit_mqtt_processor.erl”},{line,900}]},{rabbit_mqtt_reader,do_terminate,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,242}]},{gen_server2,terminate,3,[{file,“src/gen_server2.erl”},{line,1169}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,259}]}]}
2021-06-03 04:01:36.294 [error] <0.295.305> CRASH REPORT Process <0.295.305> with 0 neighbours exited with reason: no match of right hand value {timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}} in rabbit_mqtt_processor:close_connection/1 line 900 in gen_server2:terminate/3 line 1183
2021-06-03 04:01:36.294 [error] <0.292.305> Supervisor {<0.292.305>,rabbit_channel_sup} had child channel started with rabbit_channel:start_link(1, <0.32618.304>, <0.32618.304>, <0.32622.304>, <<“10.93.0.1:44382 → 10.93.0.2:1883”>>, rabbit_framing_amqp_0_9_1, {user,<<“chirpstack_as”>>,[‘Chirpstack’],[{rabbit_auth_backend_internal,none}]}, <<"/">>, [{<<“publisher_confirms”>>,bool,true},{<<“exchange_exchange_bindings”>>,bool,true},{<<“basic.nack”>>,…},…], <0.32624.304>, <0.289.305>, {amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoYFhn9qAYI+ygy5qch5P7abl3ORsRMBTw4Jn…”>>,…}) at <0.295.305> exit with reason no match of right hand value {timeout,{mqtt_node,‘rabbit#loraapp-srv-01’}} in rabbit_mqtt_processor:close_connection/1 line 900 in context child_terminated
2021-06-03 04:01:36.294 [error] <0.292.305> Supervisor {<0.292.305>,rabbit_channel_sup} had child channel started with rabbit_channel:start_link(1, <0.32618.304>, <0.32618.304>, <0.32622.304>, <<“10.93.0.1:44382 → 10.93.0.2:1883”>>, rabbit_framing_amqp_0_9_1, {user,<<“chirpstack_as”>>,[‘Chirpstack’],[{rabbit_auth_backend_internal,none}]}, <<"/">>, [{<<“publisher_confirms”>>,bool,true},{<<“exchange_exchange_bindings”>>,bool,true},{<<“basic.nack”>>,…},…], <0.32624.304>, <0.289.305>, {amqp_params_direct,<<“chirpstack_as”>>,<<“SUhIVgLkkrUfG6R/boaoYFhn9qAYI+ygy5qch5P7abl3ORsRMBTw4Jn…”>>,…}) at <0.295.305> exit with reason reached_max_restart_intensity in context shutdown
2021-06-03 04:01:37.105 [info] <0.24828.366> MQTT vhost picked using plugin configuration or default
2021-06-03 04:01:42.113 [error] <0.24828.366> MQTT cannot accept a connection: client ID registration timed out
2021-06-03 04:01:42.113 [error] <0.24828.366> MQTT cannot accept connection 10.93.0.1:35338 → 10.93.0.2:1883 due to an internal error or unavailable component
2021-06-03 04:01:46.115 [info] <0.25564.366> MQTT vhost picked using plugin configuration or default
2021-06-03 04:01:46.662 [info] <0.25564.366> accepting MQTT connection <0.25564.366> (10.93.0.1:35358 → 10.93.0.2:1883, client id: 1M4VrmghPWJsSOFRncBEeA)
2021-06-04 03:07:30.005 [info] <0.26138.369> accepting AMQP connection <0.26138.369> (10.104.1.131:46242 → 10.93.0.2:5672)
{bad_header,<<“GET / HT”>>}
2021-06-04 03:07:35.040 [error] <0.26349.369> MQTT cannot parse a frame on connection ‘10.104.1.131:60008 → 10.93.0.2:1883’, unparseable payload: <<73,0,0,0,102,0,0,0>>, error: {{badmatch,<<>>}, [{rabbit_mqtt_frame,parse_frame,3,[{file,“src/rabbit_mqtt_frame.erl”},{line,104}]},{rabbit_mqtt_reader,parse,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,358}]},{rabbit_mqtt_reader,process_received_bytes,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,289}]},{gen_server2,handle_msg,2,[{file,“src/gen_server2.erl”},{line,1067}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}
2021-06-04 03:07:35.047 [info] <0.24610.369> accepting AMQP connection <0.24610.369> (10.104.1.131:48490 → 10.93.0.2:5672)
2021-06-04 03:07:35.047 [error] <0.24610.369> closing AMQP connection <0.24610.369> (10.104.1.131:48490 → 10.93.0.2:5672):
{bad_header,<<0,0,0,22,128,1,0,1>>}
2021-06-04 03:07:35.054 [info] <0.26587.369> accepting AMQP connection <0.26587.369> (10.104.1.131:48500 → 10.93.0.2:5672)
2021-06-04 03:07:35.054 [error] <0.26587.369> closing AMQP connection <0.26587.369> (10.104.1.131:48500 → 10.93.0.2:5672):
{bad_version,{0,0,0,0}}
2021-06-04 03:07:35.063 [info] <0.26586.369> accepting AMQP connection <0.26586.369> (10.104.1.131:48506 → 10.93.0.2:5672)
2021-06-04 03:07:35.068 [info] <0.26439.369> accepting AMQP connection <0.26439.369> (10.104.1.131:48512 → 10.93.0.2:5672)
2021-06-04 03:07:35.068 [error] <0.26439.369> closing AMQP connection <0.26439.369> (10.104.1.131:48512 → 10.93.0.2:5672):
{bad_version,{2,0,9,1}}
2021-06-04 03:07:36.067 [warning] <0.26586.369> closing AMQP connection <0.26586.369> (10.104.1.131:48506 → 10.93.0.2:5672):
client unexpectedly closed TCP connection
2021-06-04 03:08:22.338 [error] <0.28654.369> MQTT cannot parse a frame on connection ‘10.104.1.131:51810 → 10.93.0.2:1883’, unparseable payload: <<“GET / HTTP/1.1\r\nConnection: Close\r\nHost: loraapp-srv-01\r\nPragma: no-cache\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, /\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n”>>, error: {{badmatch,<<“T / HTTP/1.1\r\nConnection: Close\r\nHost: loraapp-srv-01\r\nPragma: no-cac”>>}, [{rabbit_mqtt_frame,parse_frame,3,[{file,“src/rabbit_mqtt_frame.erl”},{line,104}]},{rabbit_mqtt_reader,parse,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,358}]},{rabbit_mqtt_reader,process_received_bytes,2,[{file,“src/rabbit_mqtt_reader.erl”},{line,289}]},{gen_server2,handle_msg,2,[{file,“src/gen_server2.erl”},{line,1067}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}

Related

Rabbitmq client loosing connection and does not recover

I am using Rabbitmq 3.8.16 with Vertx 3.9.4 Rabbitmq client for my backend application and noticed that sometimes the client looses the connection and it fails to recover correctly (autorecovery is turned ON). It means that after the recovery, It stops to consume messages and the durable queues has no consumers.
This happens randomly and with different exceptions. Since I am using Vertx Rabbitmq client, I cannot create different channel per consumer/publisher, I have something like 10 publishers and 10 consumers on the same node (same connection same channel) sometimes reaching up to 400 messages per second. Can it cause this kind of issues ??
Other problem can be that I have a queues representing websocket connections to my backend, these websocket connections are short living so it quite often declare and then remove a queue representing this user session. Is that a problem for Rabbitmq ?
From the Rabbitmq log I found following exceptions which were related to the connection crash:
First one :
2021-09-08 08:14:15.321 [error] <0.24867.686> ** Generic server <0.24867.686> terminating
** Last message in was {'$gen_cast',{method,{'basic.publish',0,<<"NOTIFICATION_EXCHANGE">>,<<"BROADCAST_NOTIFICATION_ADDRESS">>,false,false},{content,60,none,<<0,0>>,rabbit_framing_amqp_0_9_1,[<<"{MY_MESSAGE}">>]},flow}}
** When Server state == {ch,{conf,running,rabbit_framing_amqp_0_9_1,1,<0.24846.686>,<0.24862.686>,<0.24846.686>,<<"172.20.24.177:60848 -> 172.20.28.73:5672">>,undefined,{user,<<"backend">>,[],[{rabbit_auth_backend_internal,none}]},<<"backend">>,<<"8a4a4f71-251a-4ab6-85f6-50d594db46b9">>,<0.24850.686>,[{<<"exchange_exchange_bindings">>,bool,true},{<<"connection.blocked">>,bool,true},{<<"authentication_failure_close">>,bool,true},{<<"basic.nack">>,bool,true},{<<"publisher_confirms">>,bool,true},{<<"consumer_cancel_notify">>,bool,true}],none,200,134217728,900000,#{},1000000000},{lstate,<0.24877.686>,false},none,4927,{2,{[{4926,<<"amq.ctag-ckMzQHTLitAIZ86qk0_R0Q">>,1631088855286,{{'backend_SERVICE_QUEUE','rabbit#rabbitmq-server-2.rabbitmq-nodes.rabbitmq'},321}}],[{4925,<<"amq.ctag-xDoqkK1VmPptIM9OG3YaPw">>,1631088855286,{{'backend_SERVICE_QUEUE','rabbit#rabbitmq-server-2.rabbitmq-nodes.rabbitmq'},321}}]}},#{'backend_9fb541c5-a9ae-4bbc-99a4-ff444316b3f1' => {resource,<<"backend">>,queue,<<"9fb541c5-a9ae-4bbc-99a4-ff444316b3f1">>},'backend_5f188762-0a66-47e3-bfa8-76aa11481cb9' => {resource,<<"backend">>,queue,<<"5f188762-0a66-47e3-bfa8-76aa11481cb9">>},'backend_e4a3cec7-3f6f-4b05-bdf2-ade8a087425d' => {resource,<<"backend">>,queue,<<"e4a3cec7-3f6f-4b05-bdf2-ade8a087425d">>},'backend_e7a9834a-7ddc-4690-a317-4f19433edafd' => {resource,<<"backend">>,queue,<<"e7a9834a-7ddc-4690-a317-4f19433edafd">>},'backend_6fdcc521-4ff1-4721-bf12-cefffe1181eb' => ...,...},...}
** Reason for termination ==
** {{error,noproc},[{rabbit_fifo_client,enqueue,3,[{file,"src/rabbit_fifo_client.erl"},{line,168}]},{rabbit_quorum_queue,deliver,3,[{file,"src/rabbit_quorum_queue.erl"},{line,754}]},{rabbit_amqqueue,'-deliver/3-fun-3-',4,[{file,"src/rabbit_amqqueue.erl"},{line,2239}]},{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},{rabbit_amqqueue,deliver,3,[{file,"src/rabbit_amqqueue.erl"},{line,2236}]},{rabbit_channel,deliver_to_queues,2,[{file,"src/rabbit_channel.erl"},{line,2204}]},{rabbit_channel,handle_method,3,[{file,"src/rabbit_channel.erl"},{line,1375}]},{rabbit_channel,handle_cast,2,[{file,"src/rabbit_channel.erl"},{line,643}]}]}
2021-09-08 08:14:15.321 [error] <0.24867.686> CRASH REPORT Process <0.24867.686> with 0 neighbours exited with reason: {error,noproc} in rabbit_fifo_client:enqueue/3 line 168 in gen_server2:terminate/3 line 1183
2021-09-08 08:14:15.322 [error] <0.24859.686> Supervisor {<0.24859.686>,rabbit_channel_sup} had child channel started with rabbit_channel:start_link(1, <0.24846.686>, <0.24862.686>, <0.24846.686>, <<"172.20.24.177:60848 -> 172.20.28.73:5672">>, rabbit_framing_amqp_0_9_1, {user,<<"backend">>,[],[{rabbit_auth_backend_internal,none}]}, <<"backend">>, [{<<"exchange_exchange_bindings">>,bool,true},{<<"connection.blocked">>,bool,true},{<<"authentica...">>,...},...], <0.24850.686>, <0.24877.686>) at <0.24867.686> exit with reason {error,noproc} in rabbit_fifo_client:enqueue/3 line 168 in context child_terminated
2021-09-08 08:14:15.322 [error] <0.24859.686> Supervisor {<0.24859.686>,rabbit_channel_sup} had child channel started with rabbit_channel:start_link(1, <0.24846.686>, <0.24862.686>, <0.24846.686>, <<"172.20.24.177:60848 -> 172.20.28.73:5672">>, rabbit_framing_amqp_0_9_1, {user,<<"backend">>,[],[{rabbit_auth_backend_internal,none}]}, <<"backend">>, [{<<"exchange_exchange_bindings">>,bool,true},{<<"connection.blocked">>,bool,true},{<<"authentica...">>,...},...], <0.24850.686>, <0.24877.686>) at <0.24867.686> exit with reason reached_max_restart_intensity in context shutdown
2021-09-08 08:14:15.323 [error] <0.24846.686> Error on AMQP connection <0.24846.686> (172.20.24.177:60848 -> 172.20.28.73:5672, vhost: 'backend', state: running), channel 1:
{{error,noproc},
[{rabbit_fifo_client,enqueue,3,
[{file,"src/rabbit_fifo_client.erl"},{line,168}]},
{rabbit_quorum_queue,deliver,3,
[{file,"src/rabbit_quorum_queue.erl"},{line,754}]},
{rabbit_amqqueue,'-deliver/3-fun-3-',4,
[{file,"src/rabbit_amqqueue.erl"},{line,2239}]},
{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},
{rabbit_amqqueue,deliver,3,[{file,"src/rabbit_amqqueue.erl"},{line,2236}]},
{rabbit_channel,deliver_to_queues,2,
[{file,"src/rabbit_channel.erl"},{line,2204}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1375}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,643}]}]}
2021-09-08 08:14:15.323 [warning] <0.24846.686> Non-AMQP exit reason '{{error,noproc},[{rabbit_fifo_client,enqueue,3,[{file,"src/rabbit_fifo_client.erl"},{line,168}]},{rabbit_quorum_queue,deliver,3,[{file,"src/rabbit_quorum_queue.erl"},{line,754}]},{rabbit_amqqueue,'-deliver/3-fun-3-',4,[{file,"src/rabbit_amqqueue.erl"},{line,2239}]},{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},{rabbit_amqqueue,deliver,3,[{file,"src/rabbit_amqqueue.erl"},{line,2236}]},{rabbit_channel,deliver_to_queues,2,[{file,"src/rabbit_channel.erl"},{line,2204}]},{rabbit_channel,handle_method,3,[{file,"src/rabbit_channel.erl"},{line,1375}]},{rabbit_channel,handle_cast,2,[{file,"src/rabbit_channel.erl"},{line,643}]}]}'
Another one that I noticed is :
2021-09-02 14:59:43.260 [error] <0.17646.16> closing AMQP connection <0.17646.16> (172.20.23.201:35420 -> 172.20.36.197:5672):
missed heartbeats from client, timeout: 60s
2021-09-02 14:59:43.263 [info] <0.29592.28> Closing all channels from '172.20.23.201:35420 -> 172.20.36.197:5672' because it has been closed
And the last one :
2021-09-08 09:47:14.948 [warning] <0.7610.564> segment_writer: skipping segment as directory /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHES3OXCNJJBB4VW does not exist
2021-09-08 09:47:14.948 [warning] <0.7611.564> segment_writer: failed to open segment file /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHES0C5F3P5Y6WKO/00000001.segmenterror: enoent
2021-09-08 09:47:14.948 [warning] <0.199.564> segment_writer: failed to open segment file /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHES9RZ4RFC37MDG/00000001.segmenterror: enoent
2021-09-08 09:47:14.948 [warning] <0.7611.564> segment_writer: skipping segment as directory /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHES0C5F3P5Y6WKO does not exist
2021-09-08 09:47:14.948 [warning] <0.199.564> segment_writer: skipping segment as directory /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHES9RZ4RFC37MDG does not exist
2021-09-08 09:47:14.950 [warning] <0.7600.564> segment_writer: failed to open segment file /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHESAQL00HNNSPK4/00000001.segmenterror: enoent
2021-09-08 09:47:14.950 [warning] <0.7600.564> segment_writer: skipping segment as directory /var/lib/rabbitmq/mnesia/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/quorum/rabbit#rabbitmq-server-1.rabbitmq-nodes.rabbitmq/ORCHESAQL00HNNSPK4 does not exist
On the client side I noticed :
15:11:30.816 [vert.x-eventloop-thread-0]Fail to handle message
com.rabbitmq.client.AlreadyClosedException: connection is already closed due to connection error; cause: java.lang.IllegalStateException: Unsolicited delivery - see Channel.setDefaultConsumer to handle this case.
at com.rabbitmq.client.impl.AMQConnection.ensureIsOpen(AMQConnection.java:172)
at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:550)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.createChannel(AutorecoveringConnection.java:165)
at io.vertx.rabbitmq.impl.RabbitMQClientImpl.forChannel(RabbitMQClientImpl.java:476)
at io.vertx.rabbitmq.impl.RabbitMQClientImpl.basicPublish(RabbitMQClientImpl.java:194)
at io.vertx.reactivex.rabbitmq.RabbitMQClient.basicPublish(RabbitMQClient.java:363)
at io.vertx.reactivex.rabbitmq.RabbitMQClient.lambda$rxBasicPublish$9(RabbitMQClient.java:376)
at io.vertx.reactivex.rabbitmq.RabbitMQClient$$Lambda$699/0x00000000102c38c0.accept(Unknown Source)
at io.vertx.reactivex.impl.AsyncResultCompletable.subscribeActual(AsyncResultCompletable.java:44)
or
08:14:15.330 [AMQP Connection 10.100.56.15:5672] WARN com.rabbitmq.client.impl.ForgivingExceptionHandler - An unexpected connection driver error occured (Exception message: Connection reset)
08:14:15.332 [AMQP Connection 10.100.56.15:5672] INFO io.vertx.rabbitmq.impl.RabbitMQClientImpl - RabbitMQ connection shutdown! The client will attempt to reconnect automatically
com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=541, reply-text=INTERNAL_ERROR, class-id=0, method-id=0)
at com.rabbitmq.client.impl.AMQConnection.startShutdown(AMQConnection.java:916)
at com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:906)
at com.rabbitmq.client.impl.AMQConnection.handleConnectionClose(AMQConnection.java:844)
at com.rabbitmq.client.impl.AMQConnection.processControlCommand(AMQConnection.java:799)
at com.rabbitmq.client.impl.AMQConnection$1.processAsync(AMQConnection.java:242)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:650)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
Since those errors are not clear to my, does anybody has an idea why is this happening ??
Thank you for your help

erlang failed to resolve ipv6 addresses using parameter from rabbitmq

I'm using rabbitmq cluster in k8s which has only pure ipv6 address. inet return nxdomain error when parsing the k8s service name.
The paramter passed to erlang from rabbitmq is:
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="+A 128 -kernel inetrc '/etc/rabbitmq/erl_inetrc' -proto_dist inet6_tcp"
RABBITMQ_CTL_ERL_ARGS="-proto_dist inet6_tcp"
erl_inetrc: |-
{inet6, true}.
when rabbitmq using its plugin rabbit_peer_discovery_k8s to invoke k8s api:
2019-10-15 07:33:55.000 [info] <0.238.0> Peer discovery backend does not support locking, falling back to randomized delay
2019-10-15 07:33:55.000 [info] <0.238.0> Peer discovery backend rabbit_peer_discovery_k8s does not support registration, skipping randomized start
up delay.
2019-10-15 07:33:55.000 [debug] <0.238.0> GET https://kubernetes.default.svc.cluster.local:443/api/v1/namespaces/tazou/endpoints/zt4-crmq
2019-10-15 07:33:55.015 [debug] <0.238.0> Response: {error,{failed_connect,[{to_address,{"kubernetes.default.svc.cluster.local",443}},{inet,[inet]
,nxdomain}]}}
2019-10-15 07:33:55.015 [debug] <0.238.0> HTTP Error {failed_connect,[{to_address,{"kubernetes.default.svc.cluster.local",443}},{inet,[inet],nxdom
ain}]}
2019-10-15 07:33:55.015 [info] <0.238.0> Failed to get nodes from k8s - {failed_connect,[{to_address,{"kubernetes.default.svc.cluster.local",443}}
,
{inet,[inet],nxdomain}]}
2019-10-15 07:33:55.016 [error] <0.237.0> CRASH REPORT Process <0.237.0> with 0 neighbours exited with reason: no case clause matching {error,"{fa
iled_connect,[{to_address,{\"kubernetes.default.svc.cluster.local\",443}},\n {inet,[inet],nxdomain}]}"} in rabbit_mnesia:init_from
_config/0 line 167 in application_master:init/4 line 138
2019-10-15 07:33:55.016 [info] <0.43.0> Application rabbit exited with reason: no case clause matching {error,"{failed_connect,[{to_address,{\"kub
ernetes.default.svc.cluster.local\",443}},\n
in k8s console, the address could be resolved:
[rabbitmq]# nslookup -type=AAAA kubernetes.default.svc.cluster.local
Server: 2019:282:4000:2001::6
Address: 2019:282:4000:2001::6#53
kubernetes.default.svc.cluster.local has AAAA address fd01:abcd::1
the inet could return ipv6 address.
kubectl exec -ti zt4-crmq-0 rabbitmqctl eval 'inet:gethostbyname("kubernetes.default.svc.cluster.local").'
{ok,{hostent,"kubernetes.default.svc.cluster.local",[],inet6,16,
[{64769,43981,0,0,0,0,0,1}]}}
as I know, plugin call httpc:request to invoke k8s api. I don't know what's the gap between httpc:request and inet:gethostbyname. I also don't what's used by httpc:request to resolve the address of hostname.
I query for the rabbitmq plugin, It's said that rabbitmq plugin don't aware how erlang resovlve the address. https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/issues/55.
Anything else I could set for erl_inetrc so that erlang could resolve the ipv6 address? what did i miss to config? or how could i debug from erlang side? I'm new to erlang.
B.R,
Tao

RabbitMQ change listeners.tcp.default port is not changed how is expected

Through Homebrew I have installed RabbitMQ.
It starts with ./rabbitmq-server without any problem:
## ##
## ## RabbitMQ 3.7.6. Copyright (C) 2007-2018 Pivotal Software, Inc.
########## Licensed under the MPL. See http://www.rabbitmq.com/
###### ##
########## Logs: /usr/local/var/log/rabbitmq/rabbit#localhost.log
/usr/local/var/log/rabbitmq/rabbit#localhost_upgrade.log
Starting broker...
completed with 6 plugins.
I have read the following:
RabbitMQ Configuration
rabbitmq.conf.example
rabbitmq_conf_homebrew
Thus in the /usr/local/etc/rabbitmq path exists:
enabled_plugins
rabbitmq-env.conf
rabbitmq.conf (created manually)
The content of these files are:
enabled_plugins
[rabbitmq_management,rabbitmq_stomp,rabbitmq_amqp1_0,rabbitmq_mqtt].
rabbitmq-env.conf
CONFIG_FILE=/usr/local/etc/rabbitmq/rabbitmq
NODE_IP_ADDRESS=127.0.0.1
NODENAME=rabbit#localhost
rabbitmq.conf
# listeners.tcp.default = 5672
listeners.tcp.default = 5662
#listeners.tcp.local = 127.0.0.1:5662 <-- Alpha
#listeners.tcp.local_v6 = ::1:5662 <-- Beta
# mqtt.listeners.tcp.default = 1883
mqtt.listeners.tcp.default = 1873
# stomp.listeners.tcp.default = 61613
stomp.listeners.tcp.default = 61603
The purpose with the ports are decrease them by -10 each one. It only works for mqtt and stomp. The listeners.tcp.default value is ignored, it remains how 5672 and not with 5662 how is expected. I can confirm this showing the /usr/local/var/log/rabbitmq/rabbit#localhost.log content, as follows:
...
2018-07-29 12:46:31.461 [info] <0.321.0> Starting message stores for vhost '/'
2018-07-29 12:46:31.461 [info] <0.325.0> Message store "628WB79CIFDYO9LJI6DKMI09L/msg_store_transient": using rabbit_msg_store_ets_index to provide index
2018-07-29 12:46:31.465 [info] <0.321.0> Started message store of type transient for vhost '/'
2018-07-29 12:46:31.465 [info] <0.328.0> Message store "628WB79CIFDYO9LJI6DKMI09L/msg_store_persistent": using rabbit_msg_store_ets_index to provide index
2018-07-29 12:46:31.490 [info] <0.321.0> Started message store of type persistent for vhost '/'
2018-07-29 12:46:31.495 [info] <0.363.0> started TCP Listener on 127.0.0.1:5672
2018-07-29 12:46:31.495 [info] <0.223.0> Setting up a table for connection tracking on this node: tracked_connection_on_node_rabbit#localhost
2018-07-29 12:46:31.495 [info] <0.223.0> Setting up a table for per-vhost connection counting on this node: tracked_connection_per_vhost_on_node_rabbit#localhost
2018-07-29 12:46:31.496 [info] <0.33.0> Application rabbit started on node rabbit#localhost
2018-07-29 12:46:31.496 [info] <0.369.0> rabbit_stomp: default user 'guest' enabled
2018-07-29 12:46:31.497 [info] <0.385.0> started STOMP TCP Listener on [::]:61603
2018-07-29 12:46:31.497 [info] <0.33.0> Application rabbitmq_stomp started on node rabbit#localhost
2018-07-29 12:46:31.497 [info] <0.33.0> Application cowboy started on node rabbit#localhost
2018-07-29 12:46:31.498 [info] <0.33.0> Application rabbitmq_web_dispatch started on node rabbit#localhost
2018-07-29 12:46:31.572 [info] <0.33.0> Application rabbitmq_management_agent started on node rabbit#localhost
2018-07-29 12:46:31.600 [info] <0.438.0> Management plugin started. Port: 15672
2018-07-29 12:46:31.600 [info] <0.544.0> Statistics database started.
2018-07-29 12:46:31.601 [info] <0.33.0> Application rabbitmq_management started on node rabbit#localhost
2018-07-29 12:46:31.601 [info] <0.33.0> Application rabbitmq_amqp1_0 started on node rabbit#localhost
2018-07-29 12:46:31.601 [info] <0.557.0> MQTT retained message store: rabbit_mqtt_retained_msg_store_dets
2018-07-29 12:46:31.621 [info] <0.575.0> started MQTT TCP Listener on [::]:1873
2018-07-29 12:46:31.622 [info] <0.33.0> Application rabbitmq_mqtt started on node rabbit#localhost
2018-07-29 12:46:31.622 [notice] <0.94.0> Changed loghwm of /usr/local/var/log/rabbitmq/rabbit#localhost.log to 50
2018-07-29 12:46:31.882 [info] <0.5.0> Server startup complete; 6 plugins started.
* rabbitmq_mqtt
* rabbitmq_amqp1_0
* rabbitmq_management
* rabbitmq_management_agent
* rabbitmq_web_dispatch
* rabbitmq_stomp
Thus from above:
started TCP Listener on 127.0.0.1:5672 should be 5662
started STOMP TCP Listener on [::]:61603 changed how is expected
Management plugin started. Port: 15672 is not necessary change it
started MQTT TCP Listener on [::]:1873changed how is expected
I have the same behaviour if I enable Alpha and Beta.
The server is stopped with ./rabbitmqctl stop and started again with ./rabbitmq-server
What is missing or wrong?

Zookeeper and ActiveMQ LevelDB replication non reliable

In my current project we are trying to set up an activeMQ cluster with LevelDB replication. Our configuration has a ZooKeeper ensemble of three nodes and an ActiveMQ cluster of three nodes.
The following is the configuration used for activeMQ: (of course the hostname is different for each node in the cluster)
<persistenceAdapter>
<replicatedLevelDB
replicas="3"
bind="tcp://0.0.0.0:0"
hostname="activemq1"
zkAddress="zk1:2181,zk2:2181,zk3:2181"
zkPath="/activemq/leveldb-stores"
/>
</persistenceAdapter>
We start up three instances of zookeeper and three instances of activemq. We observe that the zookeeper leader gets correctly elected. But in activeMQ cluster Master election is not happening. Go through the log we came to know that there is a authentication problem with zookeeper. (as per the log, I am having less knowledge in zookeeper/activemq). Herewith I pasted the logs for reference.
INFO: Loading '/opt/activemq//bin/env'
INFO: Using java '/usr/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /data/activemq/activemq.pid
Java Runtime: Oracle Corporation 1.8.0_91 /usr/lib/jvm/java-8-openjdk-amd64/jre
Heap sizes: current=62976k free=59998k max=932352k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf.tmp/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq//tmp -
Dactivemq.classpath=/opt/activemq/conf.tmp:/opt/activemq//../lib/: -Dactivemq.home=/opt/activemq/ -
Dactivemq.base=/opt/activemq/ -Dactivemq.conf=/opt/activemq/conf.tmp -Dactivemq.data=/data/activemq
Extensions classpath:[/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
ACTIVEMQ_CONF: /opt/activemq/conf.tmp
ACTIVEMQ_DATA: /data/activemq
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#7823a2f9: startup date [Sat Jun 17 09:15:51 UTC 2017]; root of context hierarchy
INFO | JobScheduler using directory: /data/activemq/localhost/scheduler
INFO | Using Persistence Adapter: Replicated LevelDB[/data/activemq/leveldb, ip-172-20-44-97.ec2.internal:2181,ip-172-20-45-105.ec2.internal:2181,ip-172-20-48-226.ec2.internal:2181//activemq/leveldb-stores]
INFO | Starting StateChangeDispatcher
INFO | Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
INFO | Client environment:host.name=activemq-m1n59
INFO | Client environment:java.version=1.8.0_91
INFO | Client environment:java.vendor=Oracle Corporation
INFO | Client environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre
INFO | Client environment:java.class.path=/opt/activemq//bin/activemq.jar
INFO | Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
INFO | Client environment:java.io.tmpdir=/opt/activemq//tmp
INFO | Client environment:java.compiler=<NA>
INFO | Client environment:os.name=Linux
INFO | Client environment:os.arch=amd64
INFO | Client environment:os.version=4.4.65-k8s
INFO | Client environment:user.name=root
INFO | Client environment:user.home=/root
INFO | Client environment:user.dir=/tmp
INFO | Initiating client connection, connectString=ip-172-20-44-97.ec2.internal:2181,ip-172-20-45-105.ec2.internal:2181,ip-172-20-48-226.ec2.internal:2181 sessionTimeout=2000 watcher=org.apache.activemq.leveldb.replicated.groups.ZKClient#4b41dd5c
WARN | SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named 'Client' was found in specified JAAS configuration file: '/opt/activemq/conf.tmp/login.config'. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
WARN | unprocessed event state: AuthFailed
INFO | Opening socket connection to server ip-172-20-45-105.ec2.internal/172.20.45.105:2181
WARN | Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)[:1.8.0_91] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)[:1.8.0_91] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)[zookeeper-3.4.6.jar:3.4.6-1569965] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)[zookeeper-3.4.6.jar:3.4.6-1569965]
WARN | SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named 'Client' was found in specified JAAS configuration file: '/opt/activemq/conf.tmp/login.config'. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
INFO | Opening socket connection to server ip-172-20-48-226.ec2.internal/172.20.48.226:2181
WARN | unprocessed event state: AuthFailed
WARN | Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)[:1.8.0_91] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)[:1.8.0_91] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) [zookeeper-3.4.6.jar:3.4.6-1569965] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)[zookeeper-3.4.6.jar:3.4.6-1569965]
WARN | SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named 'Client' was found in specified JAAS configuration file: '/opt/activemq/conf.tmp/login.config'. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
INFO | Opening socket connection to server ip-172-20-44-97.ec2.internal/172.20.44.97:2181
WARN | unprocessed event state: AuthFailed
WARN | Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)[:1.8.0_91] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)[:1.8.0_91] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)[zookeeper-3.4.6.jar:3.4.6-1569965] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)[zookeeper-3.4.6.jar:3.4.6-1569965]
Please help to get out from this problem.
If anyone having idea of deploying Zookeeper with ActiveMQ cluster in Kubernetes please share your ideas. since we are trying to deploy it in Kubernetes.

Configuration of CloudAMQP Connection

I'm having difficulty configuring my connection to CloudAMQP in my deployed grails application. I can run the application locally against a locally installed RabbitMQ instance but can't figure out how to correctly define my application to run on CloudBees using the CloudAMQP service.
In my Config.groovy, I'm defining my connection info and a queue:
rabbitmq {
connectionfactory {
username = 'USERNAME'
password = 'PASSWORD'
hostname = 'lemur.cloudamqp.com'
}
queues = {
testQueue autoDelete: false, durable: false, exclusive: false
}
}
When the application starts and tries to connect, I see the following log messages:
2013-08-23 21:29:59,195 [main] DEBUG listener.SimpleMessageListenerContainer - Starting Rabbit listener container.
2013-08-23 21:29:59,205 [SimpleAsyncTaskExecutor-1] DEBUG listener.BlockingQueueConsumer - Starting consumer Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
2013-08-23 21:30:08,405 [SimpleAsyncTaskExecutor-1] WARN listener.SimpleMessageListenerContainer - Consumer raised exception, processing can restart if the connection factory supports it
org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.connection.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:112)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:163)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:228)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:119)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:163)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:109)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:199)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:524)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:381)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:545)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.net.SocketException: Connection reset
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
... 3 more
Caused by: java.net.SocketException: Connection reset
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:508)
2013-08-23 21:30:08,406 [SimpleAsyncTaskExecutor-1] INFO listener.SimpleMessageListenerContainer - Restarting Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
2013-08-23 21:30:08,406 [SimpleAsyncTaskExecutor-1] DEBUG listener.BlockingQueueConsumer - Closing Rabbit Channel: null
2013-08-23 21:30:08,407 [SimpleAsyncTaskExecutor-2] DEBUG listener.BlockingQueueConsumer - Starting consumer Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
Aug 23, 2013 9:30:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'grails'
Aug 23, 2013 9:30:11 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8634
Aug 23, 2013 9:30:11 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8634
According to https://developer.cloudbees.com/bin/view/RUN/CloudAMQP
when you bind your CloudAMQP service to your app - some config params are provided in the pattern of CLOUDAMQP_URL_ - this is the type of thing you would need to put in your config files so they can be wired in when the app launches.
Make sure to specify the virtualHost for CloudAMQP connections. That worked for me.