MassTransit error message: The supervisor is stopping, no additional scopes can be created

1,140 views
Skip to first unread message

Oren Kupershtein

unread,
Dec 21, 2016, 1:39:23 AM12/21/16
to masstransit-discuss
Hi,
We are using MT 3.2.4.
We started to get error message from our website "Failed to execute async request. The supervisor is stopping, no additional scopes can be created".
Our site is hosted on an iis (on windows server 2012) in a web farm with load balancer, and we got this error message only from one of the servers.
Recycling the application pool of this webserver seemed to fix the issue.
This error message is from one specific request only (wichh uses the CreatePublishRequest method) . no errors from other request.

Any ideas?

stack trace from error log:
 System.OperationCanceledException: The supervisor is stopping, no additional scopes can be created
   at MassTransit.Util.TaskSupervisor.CreateScope(String tag)
   at MassTransit.Util.TaskSupervisorExtensions.CreateScope(ITaskSupervisor supervisor, String tag, Func`1 afterStopped)
   at MassTransit.RabbitMqTransport.Integration.RabbitMqModelCache.ModelScope..ctor(ITaskScope supervisor)
   at MassTransit.RabbitMqTransport.Integration.RabbitMqModelCache.Send(IPipe`1 connectionPipe, CancellationToken cancellationToken)
   at MassTransit.RabbitMqTransport.RabbitMqSendTransport.<MassTransit-Transports-ISendTransport-Send>d__6`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Transports.PublishEndpoint.<MassTransit-IPublishEndpoint-Publish>d__8`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at MassTransit.Transports.PublishEndpoint.<MassTransit-IPublishEndpoint-Publish>d__8`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.PublishRequestClient`2.<MassTransit-IRequestClient<TRequest\,TResponse>-Request>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at My.Core.Messaging.AsyncExecutor.<ExecuteAsync>d__0`2.MoveNext()
   at My.Core.Messaging.AsyncExecutor.<ExecuteAsync>d__0`2.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at My.Core.Messaging.AsyncExecutor.ExecuteAsync[TRequest,TResponse](MessageTimeoutInfo timeoutInfo, IMessage chainedMessage, TRequest request)
   at MySite.<GetSpecificRequestAsync>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at GetSpecificRequestAsync(MyInput myInput, MessageTimeoutInfo timeoutInfo, IMessage chainedMessage)
   at My.Core.Messaging.AsyncExecutor.<>c__DisplayClassc`2.<<ExecuteAsyncAndWait>b__b>d__e.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at My.Core.Messaging.AsyncExecutor.<>c__DisplayClassc`2.<ExecuteAsyncAndWait>b__b()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   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.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

Chris Patterson

unread,
Dec 21, 2016, 8:48:51 AM12/21/16
to masstrans...@googlegroups.com
Something is calling Dispose on the IBus/IBusControl interface, or somehow disposing of the bus - likely due to dependency injection of the bus into a controller. Prevent that from happening and it should solve the issue.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/5ecf87f8-2f2a-4ea4-a0eb-247bcf997758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oren Kupershtein

unread,
Dec 28, 2016, 9:13:42 AM12/28/16
to masstransit-discuss
HI,
Can it be related to the fact the the application pool is being recycled? 
We initialize the IBusContol for the website in application_start in the global.asax file. can it be that it wasn't initialized correctly?

To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Dec 28, 2016, 1:55:21 PM12/28/16
to masstrans...@googlegroups.com
You might make sure you're shutting it down by calling Stop in Application_End



__
Chris Patterson




To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Anh Bui Trong

unread,
Mar 15, 2017, 8:59:58 AM3/15/17
to masstransit-discuss
We encounter this issue randomly in production (it's really frustrating) and I think you are right that may be due to dependency injection IBus to the controller, and it got disposed. But then we really need IBus to publish message in the controller, how we can achieve that but not injecting IBus into controller?
To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Mar 15, 2017, 6:27:40 PM3/15/17
to masstrans...@googlegroups.com
You can inject it, just configure your container so that it doesn't dispose of it.


To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

Anh Bui Trong

unread,
Mar 22, 2017, 11:21:55 PM3/22/17
to masstransit-discuss
Hi Chris,

I'm using Windsor Castle, IBus is registered in container with lifestyle as singleton. But our windows service is having the issue, and we have to restart the service time to time.  
Do you know how we can fix this? Greatly appreciate.

Some code snippet:


Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.

Matthew Lo

unread,
Apr 11, 2017, 1:06:19 PM4/11/17
to masstransit-discuss
Hello Chris,

Would you have any insight into this error given Anh's environment details and runtime scenario?
We are running into the same issue with a similar setup.

Thanks!
-Matthew Lo


On Wednesday, March 15, 2017 at 6:27:40 PM UTC-4, Chris Patterson wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Apr 11, 2017, 8:05:22 PM4/11/17
to masstrans...@googlegroups.com
Yeah this should be resolved with 3.5.6 and later. And also be sure to avoid keeping any ISendEndpoint references, always ask for a new one if it's been more than a minute as it may have been disposed.

If you're sending a bunch of messages it's okay to use the same one but if you only intermittently send messages ask for the endpoint by URI.  

__
Chris Patterson

From: masstrans...@googlegroups.com <masstrans...@googlegroups.com> on behalf of Matthew Lo <matthewb...@gmail.com>
Sent: Tuesday, April 11, 2017 10:06:19 AM
To: masstransit-discuss
Subject: Re: [masstransit-discuss] MassTransit error message: The supervisor is stopping, no additional scopes can be created
 
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages