temporalio / temporalio/sdk-java

DeterministicRunner is noisy about not accessed cancelled scopes and timers

Open
#631 0 comments 2 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

Expected Behavior

We have logic in Deterministic Runner detecting the fact that a promise failed, but the exception or reason of the cancellation was never accessed.
If the cancellation scope is canceled, it should be normal and expected to don't access the promises created in this scope and the logic above shouldn't be noisy about it.

Actual Behavior

If cancel a cancellation scope and never read its Promises, Deterministic Runner will make a noisy log about it, while it's an expected pattern:

12:46:38.400 [...] WARN  i.t.i.sync.DeterministicRunnerImpl - Promise completed with exception and was never accessed. The ignored exception:
io.temporal.failure.CanceledFailure: Canceled by request
	at java.base/java.lang.Thread.getStackTrace(Thread.java:1596)
	at io.temporal.internal.sync.CompletablePromiseImpl.throwFailure(CompletablePromiseImpl.java:136)
	at io.temporal.internal.sync.CompletablePromiseImpl.getImpl(CompletablePromiseImpl.java:95)
	at io.temporal.internal.sync.CompletablePromiseImpl.get(CompletablePromiseImpl.java:74)
	at io.temporal.internal.sync.DeterministicRunnerImpl.close(DeterministicRunnerImpl.java:309)
	at io.temporal.internal.sync.SyncWorkflow.close(SyncWorkflow.java:165)
	at io.temporal.internal.replay.ReplayWorkflowExecutor.close(ReplayWorkflowExecutor.java:145)
	at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.close(ReplayWorkflowRunTaskHandler.java:242)
	at io.temporal.internal.replay.WorkflowExecutorCache.lambda$new$0(WorkflowExecutorCache.java:56)
	at com.google.common.cache.LocalCache.processPendingNotifications(LocalCache.java:1810)
	at com.google.common.cache.LocalCache$Segment.runUnlockedCleanup(LocalCache.java:3463)
	at com.google.common.cache.LocalCache$Segment.postWriteCleanup(LocalCache.java:3439)
	at com.google.common.cache.LocalCache$Segment.remove(LocalCache.java:3073)
	at com.google.common.cache.LocalCache.remove(LocalCache.java:4247)
	at com.google.common.cache.LocalCache$LocalManualCache.invalidate(LocalCache.java:4887)
	at io.temporal.internal.replay.WorkflowExecutorCache.invalidate(WorkflowExecutorCache.java:140)
	at io.temporal.internal.replay.WorkflowExecutorCache.getOrCreate(WorkflowExecutorCache.java:75)
	at io.temporal.internal.replay.ReplayWorkflowTaskHandler.getOrCreateWorkflowExecutor(ReplayWorkflowTaskHandler.java:182)
	at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithEmbeddedQuery(ReplayWorkflowTaskHandler.java:200)
	at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:114)
	at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:319)
	at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:279)
	at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:73)

Steps to Reproduce the Problem

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 in DeterministicRunnerImpl.close, where the warning is emitted, and trace how CompletablePromiseImpl records an unaccessed failure. Reproduce a canceled cancellation scope whose promises are never read, then verify that the expected cancellation does not produce a noisy warning while other unaccessed failures remain reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.