将 Rebus 从 0.71.4 升级到 0.75.2 后如何解决 RabbitMq 连接问题?
我们有一个分布式处理器设置,其中有 N 个用于监控活动的仪表板、一个用于控制工作流的管理器和 N 个用于执行工作的工作人员。使用 RabbitMq 管理每个组件之间的通信。[在 Rebus 0.71.4 上] 一切都运行良好,直到我们升级到 Rebus 0.75.2(其中包括将 RabbitMq.Client 升级到 3.4.0.0)。
管理器是最复杂的组件,因为它发送多种形式的通信,包括向工作人员发布的心跳、向仪表板发布的请求/响应审计消息,以及包括工作人员要执行的工作的消息。所有这些消息传递都是同时进行的。
我们使用 1 的预取,以防止工作被长时间运行的工作任务(工作范围在 1 秒到 5 分钟之间)拖住。
现在,我们在管理器中发布期间遇到了一个不稳定的异常。:
2015-01-07 14:59:58.6205 | Error | An error occurred while rolling back the transaction! RabbitMQ.Client.Exceptions.AlreadyClosedException Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=504, text="CHANNEL_ERROR - unexpected command while processing 'tx.commit'", classId=60, methodId=40, cause= at RabbitMQ.Client.Impl.SessionBase.Transmit(Command cmd)
at RabbitMQ.Client.Impl.ModelBase.TransmitAndEnqueue(Command cmd, IRpcContinuation k)
at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body)
at RabbitMQ.Client.Framing.Impl.Model.TxRollback()
at System.Action.Invoke()
at Rebus.Bus.TxBomkarl.RaiseDoRollback()
at Rebus.Bus.Worker.<TryProcessIncomingMessage>d__1d.MoveNext()
2015-01-07 14:59:58.6275 | Warn | User exception in Rebus 1 worker 1: Rebus.Bus.QueueCommitException: An exception occurred while attempting to commit the queue transaction ---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=504, text="CHANNEL_ERROR - unexpected command while processing 'tx.commit'", classId=60, methodId=40, cause=
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply()
at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body)
at RabbitMQ.Client.Framing.Impl.Model.TxCommit()
at System.Action.Invoke()
at Rebus.Bus.TxBomkarl.RaiseDoCommit()
at Rebus.Bus.Worker.<TryProcessIncomingMessage>d__1d.MoveNext()
--- End of inner exception stack trace ---
at Rebus.Bus.Worker.<TryProcessIncomingMessage>d__1d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__0(Object state)
at Rebus.Bus.RebusSynchronizationContext.Run()
at Rebus.Bus.Worker.MainLoop()
以下是 RabbitMq 日志中的一些相关条目:
=ERROR REPORT==== 7-Jan-2015::15:41:54 ===
Error on AMQP connection <0.680.0> ([::1]:59429 -> [::1]:5672, vhost: 'efs', user: 'efs.eod', state: running), channel 1:
{amqp_error,channel_error,"unexpected command while processing 'tx.commit'",
'basic.publish'}
=WARNING REPORT==== 7-Jan-2015::15:42:55 ===
closing AMQP connection <0.553.0> ([::1]:59421 -> [::1]:5672):
connection_closed_abruptly
我们已经针对 RabitMq Server 3.3.5 和 3.4.3 进行了测试。
这种行为是可重现的,但是是零星的。而且,当它正常运行时,通信速度比 0.71.4 慢得多。
到目前为止,我们一直无法孤立地重现该问题。任何诊断问题的建议将不胜感激。