We are using MassTransit in combination with RabbitMQ. Following dll versions are being used in our Console Application:
- MassTransit
- Runtime version v4.0.30319 - Version 3.4.0.0
- MassTransit.RabbitMqTransport
- Runtime version v4.0.30319 - Version 3.4.0.0
- RabbitMQ.Client
- Runtime version v4.0.30319 - Version 4.0.0.0
- NewId
- ...
Sometimes a publish causes a crash even if the Publish method is wrapped in a try/catch
. And I have to say we are doing 2000+ publishes in a row.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at RabbitMQ.Client.Framing.Impl.Connection.HeartbeatReadTimerCallback(Object state)
at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback()
The Publish which is causing the NullReference is:
...
IBusControl BusControl = Bus.Factory.CreateUsingRabbitMq(busFactoryConfig =>
{
busFactoryConfig.Host(new Uri(ServerUrl), hostConfig =>
{
hostConfig.Username(Username);
hostConfig.Password(Password);
});
});
...
//I suppose the crash occurs after the code below is executed
TaskUtil.Await(() => BusControl.Publish(message));
I know about this issue but I don't see any clear solution for the problem even it is closed...
I want to ask, if updating the dlls is the solution, to which version do we have to update and do we have to update MassTransit dlls only (see listing above) or the RabbitMQ server also? I appreciate any help.
EDIT This is an issue occurring on our production environment. So not possible for me to debug unfortunately...
EDIT Got answer from someone on Gitter.im
I suggest you update MT to the latest version. It uses the 4.1.3 version of rabbitmq. This one should contain the fix. In case of your problem being related to the rabbitmq issue you just posted. In other cases I can't really help you. And by latest version I mean https://www.nuget.org/packages/MassTransit.RabbitMQ/3.5.7