Satellite Receiver - Race condition on startup?


I’m using a satellite receiver and get the following error message randomly on startup:

2019-01-14 10:35:38.115 ERROR NServiceBus.RecoverabilityExecutor Moving message ‘10b23666-b057-4719-be15-a9d5009cd754’ to the error queue ‘error’ because processing failed due to an exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at NServiceBus.Extensibility.ContextBag.Set[T](String key, T t) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Extensibility\ContextBag.cs:line 131
at NServiceBus.SatellitePipelineExecutor.Invoke(MessageContext messageContext) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Pipeline\SatellitePipelineExecutor.cs:line 17
at NServiceBus.Transport.RabbitMQ.MessagePump.Process(BasicDeliverEventArgs message) in C:\BuildAgent\work\bb9296e806b0a07f\src\NServiceBus.Transport.RabbitMQ\Receiving\MessagePump.cs:line 248

I’ve looked into the code and the only thing I can think of is suffering from a race condition while the satellite pipeline executor adds the transport transaction (messageContext.Extensions.Set(messageContext.TransportTransaction)).

Can anyone confirm this and is there a quick way out? For now this doesn’t seem to affect my application but the exception distracts all the time while debugging.


Hi Matt,

This sounds exactly like the bug we just released a fix for: NServiceBus.RabbitMQ 5.0.2 and 4.4.3 - Patch releases available

What version of the transport are you using?

1 Like

Hi Brandon,

I was using 5.0.0 but I have updated now and will see if this occurs again. For now, it does seem fixed, but you never know with race conditions. Thanks for the quick help!