Skip to content

Add regression test for WorkerFactory command-worker cleanup race#2952

Draft
eamsden wants to merge 1 commit into
mainfrom
codex/worker-command-await-termination-regression-test
Draft

Add regression test for WorkerFactory command-worker cleanup race#2952
eamsden wants to merge 1 commit into
mainfrom
codex/worker-command-await-termination-regression-test

Conversation

@eamsden

@eamsden eamsden commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What changed?

Added a deterministic regression test for #2951. The test completes command-worker shutdown after WorkerFactory.awaitTermination has passed its null check, reproducing the cleanup race.

Why?

The asynchronous shutdown continuation can clear workerCommandWorker before the termination callback dereferences it.

Breaking changes

None.

Server PR

N/A.

Testing

./gradlew :temporal-sdk:test --offline --tests "io.temporal.worker.WorkerShutdownTest.awaitTerminationDoesNotRaceWithWorkerCommandWorkerCleanup"

The test fails as expected on current main with the reported NullPointerException. It passes when the asynchronous workerCommandWorker = null cleanup is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant