Trying to start a workflow from asp.net and the client hangs
See original GitHub issueWhat are you really trying to do?
Trying to start a workflow from asp.net minimal api.
Describe the bug
If I create the client at startup, and then try and use that client instance within an endpoint it hangs when I call StartWorkflowAsync
.
If I create a client within the MapGet endpoint lambda it works.
Minimal Reproduction
using Temporalio.Client;
using Temporalio.Runtime;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddSimpleConsole(options =>
{
options.TimestampFormat = "yyyy-mm-ddTHH:mm:ss.ff ";
options.UseUtcTimestamp = true;
options.IncludeScopes = false;
options.SingleLine = true;
});
// If I create the client here, when I call `client.StartWorkflowAsync` the call blocks and doesn't work.
var client = await TemporalClient.ConnectAsync(new()
{
TargetHost = "localhost:7233",
Namespace = "default",
});
var app = builder.Build();
app.MapGet("/", async () =>
{
app.Logger.LogInformation("We are here");
// NOTE: If I connect here it works
// var client = await TemporalClient.ConnectAsync(new()
// {
// TargetHost = "localhost:7233",
// Namespace = "default",
// });
var id = $"simple-workflow-{Guid.NewGuid().ToString()}";
// This call blocks and doesn't work
var handle = await client.StartWorkflowAsync(
workflow: SimpleWorkflow.Ref.RunAsync,
arg: "Jake",
options: new WorkflowOptions(
id: id,
taskQueue: "my-task-queue"
)
);
var result = await handle.GetResultAsync();
return result;
});
app.Logger.LogInformation("Started");
app.Run();
Environment/Versions
- x86 Windows
- using temporal cli
Issue Analytics
- State:
- Created 5 months ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Why ASP.NET long running page request hangs forever for ...
Technically they run the report by hitting a button on the page which performs a post back to the server where the report...
Read more >ASP requests hang if ILogger throws · Issue #10499
ASP.NET requests hang indefinitely if the ILogger being used throws a NotImplementedException from the BeginScope method.
Read more >VS2019 Pro 16.8.4 C# ASP.NET Razor Page causes ...
I just want to report the errors in the ActivityLog.xml. See attachment. Just look for the errors. Fixed In: Visual Studio 2019 version...
Read more >ASP.NET Workflow - Web Apps that Support Long-Running ...
In the application start event, I create the runtime, install the persistence service, and start the runtime. And in the application end event, ......
Read more >Host and deploy ASP.NET Core Blazor WebAssembly
Learn how to host and deploy Blazor WebAssembly using ASP.NET Core, Content Delivery Networks (CDN), file servers, and GitHub Pages.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Good news. I can no longer replicate after updating core to get https://github.com/temporalio/sdk-core/pull/584 and setting my min tonic version to 0.9 and
cargo update
ing the bridge project. I will try to dig through Tonic release notes to see what it could be (though it could be one of their transitive dependencies).I will update when I make a PR to fix this (I will likely wait for https://github.com/temporalio/sdk-core/pull/544 to be merged too).
I think it might be, yes. I’ll try to see if I can replicate via https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.testing.webapplicationfactory-1 in my unit tests without too much trouble.