Skip to content

Fix NPE in WorkerState.transferLocalBatch causing worker crashes#8896

Merged
reiabreu merged 1 commit into
apache:masterfrom
dpol1:fix/7533-npe-transfer-local-batch
Jul 11, 2026
Merged

Fix NPE in WorkerState.transferLocalBatch causing worker crashes#8896
reiabreu merged 1 commit into
apache:masterfrom
dpol1:fix/7533-npe-transfer-local-batch

Conversation

@dpol1

@dpol1 dpol1 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #7533 — NPE in WorkerState.transferLocalBatch causing workers to exit.

Root cause

transferLocalBatch looks up taskToExecutorQueue.get(tuple.dest) and dereferences the result without a null check. The map contains only tasks assigned to this worker at startup. During a rebalance, peer workers with a stale assignment cache send tuples to tasks this worker no longer owns; the lookup returns null and the NPE propagates to StormServerHandler.exceptionCaught, which calls Runtime.getRuntime().exit(1).

This is a regression from STORM-2306: the 1.x transferLocal path guarded both lookups explicitly ("Received invalid messages for unknown tasks. Dropping…"). The redesign dropped both guards.

Changes

  • WorkerState.java: null check on queue after line 572; on null, drop the tuple, log a warning with tuple.dest, increment dropCount. Method visibility private → package-private for testability.
  • WorkerStateTest.java: new test verifying that a tuple addressed to an unknown task is silently dropped (no exception thrown).

Restores the 1.x "unknown task -> drop + warn" guard lost in the STORM-2306
messaging redesign. Adds WorkerStateTest to verify no NPE is thrown when a
tuple addressed to an unknown task is received.
@rzo1 rzo1 added this to the 3.0.0 milestone Jul 9, 2026
@reiabreu reiabreu added the bug label Jul 11, 2026
@reiabreu

Copy link
Copy Markdown
Contributor

Thanks for the fix @dpol1

@reiabreu reiabreu merged commit c522a4d into apache:master Jul 11, 2026
12 checks passed
@dpol1 dpol1 deleted the fix/7533-npe-transfer-local-batch branch July 11, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[STORM-3751] NPE in WorkerState.transferLocalBatch

3 participants