Search code examples
rabbitmqamqpnode-amqp

rabbitmq-node ECONNRESET on channel creation after successful connection has been established


I fresh installed rabbitmq and amqp-lib and imported

var amqp = require('amqplib/callback_api');

amqp.connect('admin://admin:guest@localhost:5672',function(error0, connection) { console.log("ok") if (error0) { throw error0; } }); this works fine and connection is established i can see it in my rabbitmq management dashboard. however adding

connection.createChannel(function(error1, channel) {
}); 

throws Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20)

i attach the debug file

2023-05-26 11:37:18.027000+03:00 [info] <0.3994.0> accepting AMQP connection <0.3994.0> (127.0.0.1:52075 -> 127.0.0.1:5672)
2023-05-26 11:37:18.031000+03:00 [info] <0.3994.0> connection <0.3994.0> (127.0.0.1:52075 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>   crasher:
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     initial call: rabbit_reader:init/3
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     pid: <0.3994.0>
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     registered_name: []
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     exception exit: {unexpected_message,{'EXIT',#Port<0.1251>,einval}}
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>       in function  rabbit_reader:handle_other/2 (rabbit_reader.erl, line 644)
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>       in call from rabbit_reader:mainloop/4 (rabbit_reader.erl, line 535)
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>       in call from rabbit_reader:run/1 (rabbit_reader.erl, line 457)
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>       in call from rabbit_reader:start_connection/5 (rabbit_reader.erl, line 356)
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     ancestors: [<0.3992.0>,<0.678.0>,<0.677.0>,<0.676.0>,<0.674.0>,
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                   <0.673.0>,rabbit_sup,<0.233.0>]
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     message_queue_len: 0
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     messages: []
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     links: [<0.3992.0>]
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     dictionary: [{client_properties,
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                       [{<<"product">>,longstr,<<"amqplib">>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                        {<<"version">>,longstr,<<"0.10.3">>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                        {<<"platform">>,longstr,<<"Node.JS v16.15.0">>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                        {<<"information">>,longstr,
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                         <<"http://squaremo.github.io/amqp.node">>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                        {<<"capabilities">>,table,
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                         [{<<"publisher_confirms">>,bool,true},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                          {<<"exchange_exchange_bindings">>,bool,true},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                          {<<"basic.nack">>,bool,true},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                          {<<"consumer_cancel_notify">>,bool,true},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                          {<<"connection.blocked">>,bool,true},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                          {<<"authentication_failure_close">>,bool,true}]}]},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                   {{ch_pid,<0.4004.0>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                    {1,#Ref<0.2813312020.1176240129.83223>}},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                   {process_name,
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                       {rabbit_reader,<<"127.0.0.1:52075 -> 127.0.0.1:5672">>}},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                   {{channel,1},
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>                    {<0.4004.0>,{method,rabbit_framing_amqp_0_9_1}}}]
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     trap_exit: true
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     status: running
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     heap_size: 2586
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     stack_size: 28
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>     reductions: 10375
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0>   neighbours:
2023-05-26 11:37:18.034000+03:00 [error] <0.3994.0> 
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     supervisor: {<0.3992.0>,rabbit_connection_sup}
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     errorContext: child_terminated
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     reason: {unexpected_message,{'EXIT',#Port<0.1251>,einval}}
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     offender: [{pid,<0.3994.0>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {id,reader},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {mfargs,{rabbit_reader,start_link,
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                                       [<0.3993.0>,{acceptor,{0,0,0,0},5672}]}},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {restart_type,intrinsic},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {shutdown,300000},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {child_type,worker}]
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     supervisor: {<0.3992.0>,rabbit_connection_sup}
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     errorContext: shutdown
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     reason: reached_max_restart_intensity
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>     offender: [{pid,<0.3994.0>},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {id,reader},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {mfargs,{rabbit_reader,start_link,
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                                       [<0.3993.0>,{acceptor,{0,0,0,0},5672}]}},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {restart_type,intrinsic},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {shutdown,300000},
2023-05-26 11:37:18.034000+03:00 [error] <0.3992.0>                {child_type,worker}]```

i checked on the rabbitmq command console if it listening on port 5672 which it was. i also ran telnet localhost 5672 on cmd which responded with AMQP ☺

Connection to host lost.


Solution

  • You are using Erlang 26 with RabbitMQ 3.11.x.

    Erlang 26 is not officially supported yet; we are working on it;

    You have to use Erlang 25. See https://www.rabbitmq.com/which-erlang.html