当失去与RabbitMQ主机的连接时,NServiceBus崩溃

时间:2016-04-12 14:33:29

标签: nservicebus nservicebus5 nservicebus-rabbitmq

我们遇到连接丢失到RabbitMQ Server后大约4-5分钟后NServiceBus崩溃的问题。

为了重现,我启动了我的应用程序,看到RabbitMQ看到连接,断开我的网络电缆,然后等待。大约5分钟后,NServiceBus主机崩溃了。

在Debug中运行时,出现以下错误消息:

Additional information: The runtime has encountered a fatal error. The address of the error was at 0xf6a94323, on thread 0xf8b8. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

在我们的服务器上,我们在EventLog中有以下内容:

Application: NServiceBus.Host.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: The following critical error was encountered by NServiceBus:
Repeated failures when communicating with the broker
    NServiceBus is shutting down.
    Stack:
       at System.Environment.FailFast(System.String, System.Exception)
       at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()

这是我们的RabbitMQ连接字符串:

<add name="NServiceBus/Transport" connectionString="host=our_host_address;VirtualHost=OurVirtualHost;UserName=OurUser;Password=******;PrefetchCount=1;DequeueTimeout=30" />

导致此次崩溃的原因是什么?有没有办法从中恢复/抓住它?我们如何才能优雅地处理与RabbitMQ服务器的断开连接?

1 个答案:

答案 0 :(得分:2)

这是因为断路器确保服务不会挂起,但如果无法正常工作则关闭。

如果连接断开,您可以将端点配置为具有更长的超时,请参阅"controlling behavior when broker connection is lost" for more information

此外,您可以将服务恢复设置为在失败时重新启动。

相关问题