英文:
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 the connection is established. I can see it in my RabbitMQ management dashboard. However, when adding:
connection.createChannel(function(error1, channel) {
});
It throws an error:
Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
I've checked the RabbitMQ command console, and it is listening on port 5672. I also ran telnet localhost 5672
in the command prompt, which responded with:
AMQP ☺
Connection to host lost.
英文:
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.
答案1
得分: 3
你正在使用Erlang 26与RabbitMQ 3.11.x。
Erlang 26目前尚未官方支持;我们正在进行相关工作。
你需要使用Erlang 25。请参考https://www.rabbitmq.com/which-erlang.html。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论