temporalio / temporalio/sdk-java

[Feature Request] Utility to detect when deadlock detector triggers

Open
#2,461 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Is your feature request related to a problem? Please describe.

Users would like the ability to programmatically detect when the deadlock detector has triggered (and caused the workflow task to fail), so they can instruct their code to stop processing. This would be used to write defensive logic to prevent zombie threads or loops from running after the workflow task has failed. This typically happens when there’s a bug in user code, such as a spinning loop that runs indefinitely.

Describe the solution you'd like

Currently, the SDK throws a DestroyWorkflowThreadError when a workflow API (e.g., sleep, scheduleActivity) is used after the deadlock detector has been triggered.

It would be great to have a method similar to Thread.currentThread().isInterrupted() that returns true (or an exception). This would allow developers to break out of loops or take alternate actions.

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the deadlock detector path and the existing DestroyWorkflowThreadError behavior when workflow APIs such as sleep or scheduleActivity are called. Define how a workflow can observe the detector before making those calls, and verify that the signal lets defensive loops stop after the workflow task fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.