Fix late tuple stream serialization in windowed bolts#8790
Open
dpol1 wants to merge 3 commits into
Open
Conversation
A TupleImpl references its topology context and cannot be serialized, so a tuple emitted as a value inside another tuple breaks as soon as it crosses a worker boundary. DetachedTuple snapshots the source component, task, stream, output fields and values of a tuple into a self-contained, Kryo-registered representation that survives serialization.
The late tuple stream emitted the original TupleImpl as a value of the outgoing tuple. TupleImpl references the topology context, which cannot be serialized, so any consumer of the late tuple stream running in a different worker failed with a KryoException. Emit a DetachedTuple copy instead, which survives serialization while still exposing the Tuple interface to consumers.
Document that the value of the late tuple field is a DetachedTuple, a serializable copy of the original tuple detached from the topology context, in the windowing guide and in the withLateTupleStream javadoc of BaseWindowedBolt, TumblingWindows and SlidingWindows.
reiabreu
reviewed
Jun 14, 2026
Contributor
There was a problem hiding this comment.
can we some extra minor tests?
- DetachedTuple can serialize and deserialize successfully when the tuple contains null
- include getShort , getByte , getBoolean in the tests
- comparing a DetachedTuple to null or a non- DetachedTuple instance
reiabreu
approved these changes
Jun 14, 2026
reiabreu
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this! Left a minor comment, but I'm happy to merge it.
Contributor
|
Thanks @dpol1, this looks good. Two small things before merge:
Otherwise looks correct to me. Happy to approve once those are in, plus @reiabreu's test requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
A windowed bolt configured with a late tuple stream (
withLateTupleStream) fails to deliver late tuples across worker boundaries. The emit wraps the inputTupleas a value, andTupleImplholds aGeneralTopologyContextthat Kryo cannot serialize, so the late stream breaks as soon as it targets a task on another worker (works in local mode only).This adds
DetachedTuple, a serializable snapshot of aTuple(source component/task/stream, fields, values, no context).WindowedBoltExecutornow emits aDetachedTupleon the late stream instead of the rawTupleImpl.Note: the value in
LATE_TUPLE_FIELDis now aDetachedTuple. It is unanchored, uses value-based equality, andgetContext()throws. Docs andwithLateTupleStreamjavadoc updated accordingly.Fix [STORM-4000] Processing late tuples from BaseWindowedBolt results in serialization exception #7782
How was the change tested
DetachedTupleTest: snapshot, field/value access, equals/hashCode, unanchored message id,getContext()throwing.WindowedBoltExecutorTest: regression test round-tripping a late tuple through Kryo withtopology.fall.back.on.java.serialization=false(the path that failed).PersistentWindowedBoltExecutorTestmocks for the new constructor reads.