Search code examples
c#rabbitmqmasstransit

'An existing connection was forcibly closed by the remote host' with Mass Transit and RabbitMQ


I have a fresh installation of RabbitMq and everything was working fine sending messages with Mass Transit and RabbitMQ. Suddently, this happened when I try to send a message ...


RabbitMQ.Client.Exceptions.OperationInterruptedException
HResult=0x80131500 Message=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. at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.BufferedStream.ReadByteSlow() at RabbitMQ.Client.Impl.InboundFrame.ReadFrom(Stream reader, Byte[] frameHeaderBuffer, ArrayPool1 pool, UInt32 maxMessageSize) at RabbitMQ.Client.Impl.SocketFrameHandler.ReadFrame() at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration() at RabbitMQ.Client.Framing.Impl.Connection.MainLoop() Source=RabbitMQ.Client StackTrace: at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout) at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body) at RabbitMQ.Client.Framing.Impl.Model._Private_ChannelOpen(String outOfBand) at RabbitMQ.Client.Framing.Impl.Connection.CreateModel() at MassTransit.RabbitMqTransport.RabbitMqConnectionContext.<CreateModel>b__26_0() at MassTransit.Util.ChannelExecutor.SynchronousFuture1.Run() --- End of stack trace from previous location --- at MassTransit.Util.ChannelExecutor.d__141.MoveNext() at MassTransit.RabbitMqTransport.RabbitMqConnectionContext.<CreateModel>d__26.MoveNext() at MassTransit.RabbitMqTransport.RabbitMqConnectionContext.<CreateModelContext>d__27.MoveNext() at MassTransit.SupervisorExtensions.CreateAgentPipe2.d__4.MoveNext() at MassTransit.Internals.TaskExtensions.<>c__DisplayClass2_01.<<OrCanceled>g__WaitAsync|0>d.MoveNext() at MassTransit.SupervisorExtensions.<CreateAgent>d__52.MoveNext()
at MassTransit.Internals.TaskExtensions.<>c__DisplayClass2_01.<<OrCanceled>g__WaitAsync|0>d.MoveNext() at MassTransit.RabbitMqTransport.ModelContextFactory.<CreateSharedModel>d__4.MoveNext() at MassTransit.Agents.PipeContextSupervisor1.d__7.MoveNext()
at MassTransit.Agents.PipeContextSupervisor1.<Send>d__7.MoveNext() at MassTransit.Agents.PipeContextSupervisor1.d__7.MoveNext()
at MassTransit.SupervisorExtensions.<>c__DisplayClass5_02.<<CreateAgent>g__HandleSupervisorTask|0>d.MoveNext() at MassTransit.SupervisorExtensions.<CreateAgent>d__52.MoveNext()
at MassTransit.RabbitMqTransport.ScopeModelContextFactory.d__4.MoveNext() at MassTransit.Agents.PipeContextSupervisor1.<Send>d__7.MoveNext() at MassTransit.Agents.PipeContextSupervisor1.d__7.MoveNext()
at MassTransit.Agents.PipeContextSupervisor`1.d__7.MoveNext()
at MassTransit.Transports.HostConfigurationRetryExtensions.d__0.MoveNext()


My Mass Transit setup is pretty straight forward...


  conf.UsingRabbitMq((context, cfg) =>
        {
            cfg.Host("localhost", "/", h =>
            {
                h.Username("guest");
                h.Password("guest");
            });
        });

And my RabbitMQ Status is this .....


Status of node rabbit@DEV-BEGUEST ... Runtime

OS PID: 6808 OS: Windows Uptime (seconds): 818 Is under maintenance?: false RabbitMQ version: 3.11.16 RabbitMQ release series support status: supported Node name: rabbit@DEV-BEGUEST Erlang configuration: Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns] Crypto library: OpenSSL 3.1.0 14 Mar 2023 Erlang processes: 405 used, 1048576 limit Scheduler run queue: 1 Cluster heartbeat timeout (net_ticktime): 60

Plugins

Enabled plugin file: c:/Users/Xavi/AppData/Roaming/RabbitMQ/enabled_plugins Enabled plugins:

  • rabbitmq_management * amqp_client * rabbitmq_web_dispatch * cowboy * cowlib * rabbitmq_management_agent

Data directory

Node data directory: c:/Users/Xavi/AppData/Roaming/RabbitMQ/db/rabbit@DEV-BEGUEST-mnesia Raft data directory: c:/Users/Xavi/AppData/Roaming/RabbitMQ/db/rabbit@DEV-BEGUEST-mnesia/quorum/rabbit@DEV-BEGUEST

Config files

  • c:/Users/Xavi/AppData/Roaming/RabbitMQ/advanced.config

Log file(s)

  • * c:/Users/Xavi/AppData/Roaming/RabbitMQ/log/rabbit@DEV-BEGUEST.log * c:/Users/Xavi/AppData/Roaming/RabbitMQ/log/rabbit@DEV-BEGUEST_upgrade.log

Alarms

(none)

Memory

Total memory used: 0.0885 gb Calculation strategy: rss Memory high watermark setting: 0.4 of available memory, computed to: 5.9848 gb

code: 0.0375 gb (38.74 %) other_proc: 0.0289 gb (29.85 %) other_system: 0.0223 gb (23.04 %) other_ets: 0.003 gb (3.07 %) binary: 0.0015 gb (1.59 %) atom: 0.0015 gb (1.53 %) metrics: 0.0011 gb (1.1 %) reserved_unallocated: 0.001 gb (1.08 %) plugins: 0.0007 gb (0.74 %) mgmt_db: 0.0002 gb (0.16 %) mnesia: 0.0001 gb (0.08 %) connection_other: 0.0 gb (0.03 %) msg_index: 0.0 gb (0.03 %) quorum_ets: 0.0 gb (0.03 %) quorum_queue_procs: 0.0 gb (0.0 %) quorum_queue_dlx_procs: 0.0 gb (0.0 %) stream_queue_procs: 0.0 gb (0.0 %) stream_queue_replica_reader_procs: 0.0 gb (0.0 %) connection_readers: 0.0 gb (0.0 %) connection_writers: 0.0 gb (0.0 %) connection_channels: 0.0 gb (0.0 %) queue_procs: 0.0 gb (0.0 %) queue_slave_procs: 0.0 gb (0.0 %) stream_queue_coordinator_procs: 0.0 gb (0.0 %) allocated_unused: 0.0 gb (0.0 %)

File Descriptors

Total: 2, limit: 65439 Sockets: 0, limit: 58893

Free Disk Space

Low free disk space watermark: 0.05 gb Free disk space: 67.6863 gb

Totals

Connection count: 0 Queue count: 0 Virtual host count: 1

Listeners

Interface: [::], port: 15672, protocol: http, purpose: HTTP API Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0 Interface: 0.0.0.0, port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0


Windows firewall is OFF.

I don't really understand why this was working and suddently I get this error.

Thank you in advance!


Solution

  • The problem here is that you are using Erlang 26 with RabbitMQ 3.11.x. You have to use Erlang 25 for RAbbitMQ 3.11.x 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.