Fix ReceivedChunks::spill() throwing on control messages#975
Open
Matt711 wants to merge 4 commits intorapidsai:mainfrom
Open
Fix ReceivedChunks::spill() throwing on control messages#975Matt711 wants to merge 4 commits intorapidsai:mainfrom
ReceivedChunks::spill() throwing on control messages#975Matt711 wants to merge 4 commits intorapidsai:mainfrom
Conversation
Contributor
Author
|
/ok to test bda7ee3 |
bda7ee3 to
214cc0f
Compare
Contributor
Author
|
/ok to test 7606a43 |
madsbk
approved these changes
Apr 17, 2026
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.
ReceivedChunks::spill()iterated all chunks in the postbox and calledchunk.data_memory_type()as the left operand of||, so C++ evaluated it before thesize == 0guard could short-circuit. Control messages (finish tokens) have no data buffer by design (data_ == nullptr), sodata_memory_type()hitsRAPIDSMPF_EXPECTS(data_, "data buffer is not set")and fails.The fix is to reorder the condition to check
size == 0and!is_data_buffer_set()first, sodata_memory_type()is only called when there's actually a buffer to inspect.More context: xref rapidsai/cudf#21750
Details
This originally came up when running TPC-DS Q67 with
--executor streaming --runtime rapidsmpf --spill-to-pinned-memory --n-workers 1. The query was running under memory pressure (that's the point of--spill-to-pinned-memory). During the shuffle phase,partition_and_packcalledbr->reserve_device_memory_and_spill()internally, which triggered the spill manager to invoke all registered spill callbacks. This includes the one registered byShufflerAsync. That callback calledReceivedChunks::spill(), which iterated over chunks in the postbox. By that point, finish tokens (control messages) had already arrived in the postbox, and callingdata_memory_type()on one threw becausedata_was null.