RabbitMQ 在调用 CreateModel() 方法时关闭了连接。

huangapple go评论78阅读模式
英文:

RabbitMQ closed connection on method CreateModel()

问题

I'm trying to run Producer example from tutorials, but RabbitMQ closed connection with exception:

Exception thrown: 'RabbitMQ.Client.Exceptions.OperationInterruptedException' in RabbitMQ.Client.dll
An unhandled exception of type 'RabbitMQ.Client.Exceptions.OperationInterruptedException' occurred in RabbitMQ.Client.dll
The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.

Code is:

var factory = new ConnectionFactory { HostName = "localhost" };
var connection = factory.CreateConnection();
var channel = connection.CreateModel(); // < -- crash is here on this line

Notes:

  1. RabbitMQ started and working - is easy to send/get message manually via RabbitMQ Management web-UI.
  2. Status or RabbitMQ received by command rabbitmq-diagnostics.bat status is ok, no one problem.
  3. exe-file added to Windows-firewall for avoid any blocking
  4. From the Wireshark we can see that RabbitMQ accepts connection and after some actions - sends Reset:

RabbitMQ 在调用 CreateModel() 方法时关闭了连接。

From the RabbitMQ logs:

2023-05-17 19:49:59.763000+03:00 [info] <0.930.0> accepting AMQP connection <0.930.0> ([::1]:49412 -> [::1]:5672)
2023-05-17 19:49:59.779000+03:00 [info] <0.930.0> connection <0.930.0> ([::1]:49412 -> [::1]:5672): user 'guest' authenticated and granted access to vhost '/'
2023-05-17 19:50:00.784000+03:00 [error] <0.930.0>   crasher:
2023-05-17 19:50:00.784000+03:00 [error] <0.930.0>     initial call: rabbit_reader:init/3
...
2023-05-17 19:50:00.784000+03:00 [error] <0.928.0>     offender: [{pid,<0.930.0>},
...

QUESTION: how to fix this issue?

英文:

I'm trying to run Producer example from tutorials, but RabbitMQ closed connection with exception:

Exception thrown: 'RabbitMQ.Client.Exceptions.OperationInterruptedException' in RabbitMQ.Client.dll
An unhandled exception of type 'RabbitMQ.Client.Exceptions.OperationInterruptedException' occurred in RabbitMQ.Client.dll
The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.

Code is:

var factory = new ConnectionFactory { HostName = &quot;localhost&quot; };
var connection = factory.CreateConnection();
var channel = connection.CreateModel(); // &lt;-- crash is here on this line

Notes:

  1. RabbitMQ started and working - is easy to send/get message manually via RabbitMQ Management web-UI.
  2. Status or RabbitMQ received by command rabbitmq-diagnostics.bat status is ok, no one problem.
  3. exe-file added to Windows-firewall for avoid any blocking
  4. From the Wireshark we can see that RabbitMQ accepts connection and after some actions - sends Reset:

RabbitMQ 在调用 CreateModel() 方法时关闭了连接。

From the RabbitMQ logs:

2023-05-17 19:49:59.763000+03:00 [info] &lt;0.930.0&gt; accepting AMQP connection &lt;0.930.0&gt; ([::1]:49412 -&gt; [::1]:5672)
2023-05-17 19:49:59.779000+03:00 [info] &lt;0.930.0&gt; connection &lt;0.930.0&gt; ([::1]:49412 -&gt; [::1]:5672): user &#39;guest&#39; authenticated and granted access to vhost &#39;/&#39;
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;   crasher:
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     initial call: rabbit_reader:init/3
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     pid: &lt;0.930.0&gt;
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     registered_name: []
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     exception exit: {unexpected_message,{&#39;EXIT&#39;,#Port&lt;0.229&gt;,einval}}
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;       in function  rabbit_reader:handle_other/2 (rabbit_reader.erl, line 644)
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;       in call from rabbit_reader:mainloop/4 (rabbit_reader.erl, line 535)
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;       in call from rabbit_reader:run/1 (rabbit_reader.erl, line 457)
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;       in call from rabbit_reader:start_connection/5 (rabbit_reader.erl, line 356)
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     ancestors: [&lt;0.928.0&gt;,&lt;0.603.0&gt;,&lt;0.602.0&gt;,&lt;0.601.0&gt;,&lt;0.599.0&gt;,&lt;0.598.0&gt;,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                   rabbit_sup,&lt;0.233.0&gt;]
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     message_queue_len: 0
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     messages: []
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     links: [&lt;0.928.0&gt;]
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     dictionary: [{{ch_pid,&lt;0.939.0&gt;},{1,#Ref&lt;0.2052854348.121110529.34620&gt;}},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                   {client_properties,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                       [{&lt;&lt;&quot;product&quot;&gt;&gt;,longstr,&lt;&lt;&quot;RabbitMQ&quot;&gt;&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;version&quot;&gt;&gt;,longstr,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                         &lt;&lt;&quot;6.5.0+4c91cae8ae5eb0194e02a83f1b0cedfe29ad8312&quot;&gt;&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;platform&quot;&gt;&gt;,longstr,&lt;&lt;&quot;.NET&quot;&gt;&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;copyright&quot;&gt;&gt;,longstr,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                         &lt;&lt;&quot;Copyright (c) 2007-2020 VMware, Inc.&quot;&gt;&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;information&quot;&gt;&gt;,longstr,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                         &lt;&lt;&quot;Licensed under the MPL. See https://www.rabbitmq.com/&quot;&gt;&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;capabilities&quot;&gt;&gt;,table,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                         [{&lt;&lt;&quot;publisher_confirms&quot;&gt;&gt;,bool,true},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                          {&lt;&lt;&quot;exchange_exchange_bindings&quot;&gt;&gt;,bool,true},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                          {&lt;&lt;&quot;basic.nack&quot;&gt;&gt;,bool,true},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                          {&lt;&lt;&quot;consumer_cancel_notify&quot;&gt;&gt;,bool,true},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                          {&lt;&lt;&quot;connection.blocked&quot;&gt;&gt;,bool,true},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                          {&lt;&lt;&quot;authentication_failure_close&quot;&gt;&gt;,bool,true}]},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                        {&lt;&lt;&quot;connection_name&quot;&gt;&gt;,void,undefined}]},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                   {process_name,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                       {rabbit_reader,&lt;&lt;&quot;[::1]:49412 -&gt; [::1]:5672&quot;&gt;&gt;}},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                   {{channel,1},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;                    {&lt;0.939.0&gt;,{method,rabbit_framing_amqp_0_9_1}}}]
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     trap_exit: true
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     status: running
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     heap_size: 1598
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     stack_size: 28
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;     reductions: 9624
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt;   neighbours:
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.930.0&gt; 
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     supervisor: {&lt;0.928.0&gt;,rabbit_connection_sup}
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     errorContext: child_terminated
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     reason: {unexpected_message,{&#39;EXIT&#39;,#Port&lt;0.229&gt;,einval}}
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     offender: [{pid,&lt;0.930.0&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {id,reader},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {mfargs,{rabbit_reader,start_link,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                                       [&lt;0.929.0&gt;,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                                        {acceptor,{0,0,0,0,0,0,0,0},5672}]}},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {restart_type,intrinsic},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {shutdown,300000},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {child_type,worker}]
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     supervisor: {&lt;0.928.0&gt;,rabbit_connection_sup}
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     errorContext: shutdown
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     reason: reached_max_restart_intensity
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;     offender: [{pid,&lt;0.930.0&gt;},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {id,reader},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {mfargs,{rabbit_reader,start_link,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                                       [&lt;0.929.0&gt;,
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                                        {acceptor,{0,0,0,0,0,0,0,0},5672}]}},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {restart_type,intrinsic},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {shutdown,300000},
2023-05-17 19:50:00.784000+03:00 [error] &lt;0.928.0&gt;                {child_type,worker}]

QUESTION: how to fix this issue?

答案1

得分: 13

对于未来的读者。

这里的问题是您正在使用Erlang 26与RabbitMQ 3.11.x。
您必须使用Erlang 25。
请查看https://www.rabbitmq.com/which-erlang.html

Erlang 26目前尚未得到官方支持,我们正在努力工作;在某个时候3.12.x将会得到支持。

英文:

For future readers.

The problem here is that you are using Erlang 26 with RabbitMQ 3.11.x.
You have to use Erlang 25.
See https://www.rabbitmq.com/which-erlang.html

Erlang 26 is not officially supported yet, we are working on it; at some point in 3.12.x will be supported.

答案2

得分: 0

在Windows中,卸载Erlang 26并不容易 - 您需要卸载,然后删除以下位置的所有文件:

C:\Program Files\Erlang OTP\erts-14.1

否则,下次安装RabbitMQ时,它将绑定到此版本。

在regedit中查看以下值:

HKEY_LOCAL_MACHINE\SOFTWARE\Ericsson\Erlang\ErlSrv\1.1\RabbitMQ
Machine

应为

C:\Program Files\Erlang OTP\erts-13.0.4\bin\erl.exe

而不是erts-14.1。

英文:

in windows, unistall Erlang 26 is not easy - you need to unistall , and then delete all files in

C:\Program Files\Erlang OTP\erts-14.1

or else the next time you install
RabbitMQ it will bound to this version

in regedit see that value of

HKEY_LOCAL_MACHINE\SOFTWARE\Ericsson\Erlang\ErlSrv\1.1\RabbitMQ\
Machine 

is

C:\Program Files\Erlang OTP\erts-13.0.4\bin\erl.exe

and not erts-14.1

huangapple
  • 本文由 发表于 2023年5月18日 01:05:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76274566.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定