Azure / Azure/durabletask

TaskHubWorker.StopAsync() fails with MessagingException

Open
#107 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.7k
Forks
335
Avg merge
2d 23h
Merged PRs (30d)
6

Description

The `TaskHubWorker.StopAsync()` code path always fails with a MessagingException when using the Service Bus provider.

Here is my minimal repro code:

```csharp
public static void Run()
{
const string HubName = "DurableTaskTestHub";
string servicebusConnectionString = ConfigurationManager.ConnectionStrings["DurableFunctions.ServiceBus"].ConnectionString;
string storageConnectionString = ConfigurationManager.ConnectionStrings["DurableFunctions.Storage"].ConnectionString;

var serviceBusOrchestrationService = new ServiceBusOrchestrationService(
servicebusConnectionString,
HubName,
null,
null,
new ServiceBusOrchestrationServiceSettings());
serviceBusOrchestrationService.CreateIfNotExistsAsync().Await();

Console.WriteLine($"Starting the host.");

var worker = new TaskHubWorker(serviceBusOrchestrationService);
worker.AddTaskOrchestrations(typeof(SimpleOrchestration));
worker.StartAsync().Await();

Console.WriteLine("Stopping host");

Stopwatch sw = Stopwatch.StartNew();
worker.StopAsync(true).Await();
Console.WriteLine($"Stopped after {sw}.");

Console.WriteLine("Press [ENTER] to exit.");
Console.ReadLine();
}
```

Here is the call stack:
```
Microsoft.ServiceBus.Messaging.MessagingException occurred
HResult=0x80131500
Message=50002: Provider Internal Error, Resource:sb://cgillum-sbns.servicebus.windows.net/durabletasktesthub/orchestrator. TrackingId:d89f9ec2-0c45-40e5-8127-26db4b917583_G9, SystemTracker:cgillum-sbns.servicebus.windows.net:DurableTaskTestHub/orchestrator, Timestamp:7/25/2017 6:17:14 PM
Source=Microsoft.ServiceBus
StackTrace:
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnEndClose(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.ClientEntity.EndClose(IAsyncResult result)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at DurableTask.ServiceBus.ServiceBusOrchestrationService.d__29.MoveNext() in C:\Code\GitHub\durabletask\src\DurableTask.ServiceBus\ServiceBusOrchestrationService.cs:line 189
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at DurableTask.Core.TaskHubWorker.d__19.MoveNext() in C:\Code\GitHub\durabletask\src\DurableTask.Core\TaskHubWorker.cs:line 160
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Testing2.ExtensionMethods.Await(Task task) in C:\Users\cgillum\Documents\Visual Studio 2015\Projects\Testing2\ExtensionMethods.cs:line 13
at Testing2.Categories.DurableTasks.Run() in C:\Users\cgillum\Documents\Visual Studio 2015\Projects\Testing2\Categories\DurableTasks.cs:line 48
at Testing2.Program.Main(String[] args) in C:\Users\cgillum\Documents\Visual Studio 2015\Projects\Testing2\Program.cs:line 41

Inner Exception 1:
FaultException: 50002: Provider Internal Error, Resource:sb://cgillum-sbns.servicebus.windows.net/durabletasktesthub/orchestrator. TrackingId:d89f9ec2-0c45-40e5-8127-26db4b917583_G9, SystemTracker:cgillum-sbns.servicebus.windows.net:DurableTaskTestHub/orchestrator, Timestamp:7/25/2017 6:17:14 PM
```

I'm able to run orchestrations successfully on this Service Bus namespace. Only the shutdown sequence seems to be problematic. Note that it does not matter whether I use `StopAsync(true)` or `StopAsync(false)`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.