Skip to content

Fix WorkerFactory command-worker cleanup race - #2952

Open
eamsden wants to merge 3 commits into
mainfrom
codex/worker-command-await-termination-regression-test
Open

Fix WorkerFactory command-worker cleanup race#2952
eamsden wants to merge 3 commits into
mainfrom
codex/worker-command-await-termination-regression-test

Conversation

@eamsden

@eamsden eamsden commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What changed?

Why?

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

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.

@dplyukhin
dplyukhin marked this pull request as ready for review August 24, 2026 15:23
@dplyukhin
dplyukhin requested a review from a team as a code owner August 24, 2026 15:23
@dplyukhin dplyukhin changed the title Add regression test for WorkerFactory command-worker cleanup race Fix WorkerFactory command-worker cleanup race Aug 24, 2026
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.

WorkerFactory.awaitTermination races with command-worker cleanup

2 participants