Recycling application pool invalidates all Signal Url
See original GitHub issueHi, I am using Elsa 1.5.4.1816 which seems to be the latest to date and I seem to have very fundamental issue. I have .Net standard 5.0 project which runs Elsa flows.
I am using blocking activity as singlaed and generating my signal using the following:
private async Task<string> GetSignalUrl(WorkflowExecutionContext context, string signalName)
{
try
{
WorkflowExpression<string> urlExpression =
new JavaScriptExpression<string>("`${signalUrl('" + signalName + "')}`");
string signalUrl = await context.EvaluateAsync(urlExpression, CancellationToken.None);
return signalUrl;
}
catch (Exception e)
{
_logger.LogError(e.ToString());
throw;
}
}
I am then dispatching email and display it on UI for the next activity to signal. Everything is working fine and our complex flow finishes fine as long as we don’t recycle application pool OR restart the website.
Since these are long running flows, it is almost with certainty that we have to deploy a code with bug fixes and/or new features and at that time we will have to stop and start the application pool.
Once application pool recycles, all the urls generated using the above code is not valid anymore and I get 404 for all the workflows.
I don’t know whether it is a bug or if I am doing something which is not correct.
I will appreciate if someone can promptly respond with their experience and/or solution. We are already in UA and ready to go live next week and I discovered this huge issue.
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
As mentioned by @sfmskywalker we have take care of this from startup itself… For people like me looking for a solution, here is what I did:
services.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(Configuration.GetSection(“DataProtectionConfiguration:DataProtectionKeyPath”).Value.ToString())) .ProtectKeysWithCertificate(new X509Certificate2(Configuration.GetSection(“DataProtectionConfiguration:SigningCertificatePfxFilePath”).Value.ToString(), Configuration.GetSection(“DataProtectionConfiguration:SigningCertificatePfxFilePassword”).Value.ToString())) .SetDefaultKeyLifetime(TimeSpan.FromDays(Convert.ToInt32(Configuration.GetSection(“DataProtectionConfiguration:DataProtectionKeyExpiry”).Value))) .SetApplicationName(“APPLICATION_NAME”)
I can confirm that, after this changes, it survives my app pool restarts, new deployment, etc. Flow still can continue just fine.
This issue Now can be closed.
Does that mean “not a bug, and not currently earmarked for doing any code change in Elsa 2.0” ? I’m not suggesting immediately closing this, since it doesn’t seem like we are all 100% certain about the root cause, but it seems we think it’s a deployment/environment-specific config that needs making and not part of Elsa.