Open dhiaayachi opened 2 months ago
This issue describes a scenario where a Workflow Execution appears as "Running" in the Temporal Web UI but is actually in a failed state. This can occur due to various reasons like non-deterministic code changes, missing exports, or errors that aren't caught in your code.
Here's a breakdown of the problem and potential solutions:
Workflow Executions in Temporal can be in one of two states: Open or Closed.
The scenarios you described highlight common causes for Workflow Execution failures that can appear in the "Running" state:
To detect these failures, you can leverage the following methods:
temporal workflow show
) or the Temporal Web UI to review the Event History and locate errors or unexpected events.Since the workflow "completes" without entering a failed state, it seems like the code is encountering an uncaught error, which is being masked by the execution model, potentially in the form of an exception that is not considered a fatal error.
Here's how you can debug further:
WorkflowTaskFailed
with a specific cause.DEBUG
or TRACE
, to see more detailed information about the Workflow Execution.try...catch
blocks in your Workflow code to capture and handle any exceptions, logging them or responding to them appropriately, ensuring that the Workflow transitions to a Failed
state in the Temporal UI.Additional Tips
I hope this explanation helps you identify and address the issue. Please feel free to provide additional information or code snippets if you need further assistance.
Thanks for reporting this issue.
Temporal Workflows can't detect failures that cause them to be suspended, such as missing exports, but you can use workflow.GetInfo
to verify the state of the workflow and identify potential issues:
async function myWorkflow(name: string): Promise<void> {
try {
// Your workflow logic here
} catch (err) {
console.log('workflow failed: ', err);
const info = workflow.GetInfo();
if (info.executionStatus === ExecutionStatus.RUNNING) {
console.log('Workflow is running, but failed unexpectedly.');
console.log('Workflow History: ', info.history);
}
}
}
Temporal CLI temporal workflow show
command could also help.
Is your feature request related to a problem? Please describe. If I do this https://github.com/temporalio/samples-typescript/compare/main...bijeebuss:samples-typescript:main and then start the workflow it will show up as "Running" but it's actually in a sort of failed state. It also does this in other cases like when you forget to export the workflow.
Things I tried
Describe the solution you'd like A way to detect when a workflow enters a state like this. Maybe it already exists but I can't find anything