.net RabbitMQ正在关闭AMQP连接,出现错误{握手超时,帧头}

svmlkihl  于 2023-02-10  发布在  .NET
关注(0)|答案(1)|浏览(2072)

我们有两个dotnet应用程序,分别发布和订阅RabbitMQ。我们的开发人员在本地测试了它,它们在工作站(通过Visual Studio启动)上运行良好。但是,当我们将它们构建到容器中并运行它们时,RabbitMQ日志将显示以下错误消息:

2022-11-01 09:29:15.998692+00:00 [info] <0.1560.868> accepting AMQP connection <0.1560.868>
2022-11-01 09:31:22.599983+00:00 [error] <0.2112.868> closing AMQP connection <0.2112.868>
2022-11-01 09:31:22.599983+00:00 [error] <0.2112.868> {handshake_timeout,frame_header}

下面是我们的dotnet容器上的错误消息:

RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
---> RabbitMQ.Client.Exceptions.PossibleAuthenticationFailureException: Possibly caused by authentication failure
---> RabbitMQ.Client.Exceptions.OperationInterruptedException: 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: Connection reset by peer.
---> System.Net.Sockets.SocketException (104): Connection reset by peer
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 System.IO.BufferedStream.ReadByte()
  at RabbitMQ.Client.Impl.InboundFrame.ReadFrom(Stream reader, Byte[] frameHeaderBuffer, ArrayPool`1 pool, UInt32 maxMessageSize)
  at RabbitMQ.Client.Impl.SocketFrameHandler.ReadFrame()
  at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration()
  at RabbitMQ.Client.Framing.Impl.Connection.MainLoop()
  at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
  at RabbitMQ.Client.Impl.ModelBase.ConnectionStartOk(IDictionary`2 clientProperties, String mechanism, Byte[] response, String locale)
  at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()
  --- End of inner exception stack trace ---
  at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()
  at RabbitMQ.Client.Framing.Impl.Connection.Open(Boolean insist)
  at RabbitMQ.Client.Framing.Impl.Connection..ctor(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler, String clientProvidedName)
  at RabbitMQ.Client.Framing.Impl.Connection..ctor(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler, ArrayPool`1 memoryPool, String clientProvidedName)
  at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IFrameHandler fh)
  at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints)
  at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
  --- End of inner exception stack trace ---

我花了两天时间在谷歌上搜索和排除故障,但我自己不是开发人员,找不到任何类似的问题。任何帮助和指导将不胜感激。
RabbitMQ版本:3.10.5 Erlang语言版本:24.3.4 .NET版本:6.0.10 RabbitMQ客户端库版本:6.2.1

wa7juj8i

wa7juj8i1#

我在rabbit服务器上遇到了类似的异常{handshake_timeout,frame_header}问题。
在较旧的客户端版本(5.2)中,它可以正常工作。
将RequestedHeartbeat更改为1200(从3600)解决了这个问题-但为什么呢?
祝你今天愉快
错误:?{握手超时,帧头}?
2023年2月8日09:43:20.063804 + 00:00 [信息]接受AMQP连接(x. x. x:35716-〉y. y. y:5672)<0.30223.3> accepting AMQP connection <0.30223.3> (x.x.x.x:35716 -> y.y.y.y:5672)
2023年2月8日09:43:29.915472 + 00:00 [错误]关闭AMQP连接(x. x. x:35716-〉y. y. y:5672):<0.30223.3> closing AMQP connection <0.30223.3> (x.x.x.x:35716 -> y.y.y.y:5672):
2023年2月8日09:43:29.915472 + 00:00 [错误] {握手超时,帧头}<0.30223.3> {handshake_timeout,frame_header}
解决方案:
将请求心跳降低到1200(3000、3600失败)
.请求心跳=时间跨度.从秒(1200);//beat是请求心跳超时的1/2

Armbian客户端

"RabbitMQ.客户端"版本="6.4.0"
微软. netcore.应用程序.运行时. linux-arm\5. 0. 17
5.15.80-11月30日星期三11:13:48 UTC 2022 armv7l GNU/Linux

Docker主机

兔子MQ 3.11.5爱尔兰语25.2
发布日期:2022年12月13日发布版本:x86_64 GNU/Linux

相关问题