[rabbitmq-discuss] Bug in SessionManager.AutoCloseConnection() (race condition, crashes program)

Eugene Kirpichov ekirpichov at gmail.com
Tue Oct 4 18:49:55 BST 2011


Hi,

SessionManager.AutoCloseConnection can crash with the following stacktrace:
RabbitMQ.Client.Exceptions.AlreadyClosedException
  at RabbitMQ.Client.Impl.SessionBase.Transmit(RabbitMQ.Client.Impl.Command)
  at RabbitMQ.Client.Impl.MainSession.Transmit(RabbitMQ.Client.Impl.Command)
  at RabbitMQ.Client.Impl.ConnectionBase.Close(RabbitMQ.Client.ShutdownEventArgs,
Boolean, Int32)
  at RabbitMQ.Client.Impl.SessionManager.AutoCloseConnection()
  at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object, Boolean)
  at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object)
  at System.Threading.ThreadHelper.ThreadStart()

This happens if you close the client yourself at the same time that
it's due to be autoclosed (a strange but apparently possible
situation).

I haven't yet investigated further why this happened, but in any case
I think that the RabbitMQ internal threads must absolutely never
crash, even if that implies wrapping them in dumb try/catch/ignore,
'cause they take down the whole .NET process with them.

-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/


More information about the rabbitmq-discuss mailing list