fix: [branch-0.14] backport #3924 - share unified memory pools across native execution contexts#3938
Merged
andygrove merged 2 commits intoapache:branch-0.14from Apr 14, 2026
Conversation
Remove tracing helper functions (register_memory_pool, unregister_and_total, total_reserved_for_thread, log_jemalloc_usage) whose call sites do not exist on branch-0.14, along with their now-unused imports.
59bb1d2 to
a8529ed
Compare
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.
Which issue does this PR close?
Backport of #3924 to
branch-0.14. Closes #3921.Rationale for this change
When Comet executes a shuffle, it creates two native execution contexts that run concurrently within the same Spark task. Previously, each context created its own memory pool with the full per-task memory limit, effectively allowing 2x the intended memory to be consumed. This caused significantly higher memory usage than expected, leading to OOM errors.
What changes are included in this PR?
Cherry-pick of #3924 with minor conflict resolution (added missing
parking_lot::Muteximport that was not present on the 0.14 branch).Changes from the original PR:
fair_unifiedandgreedy_unifiedmemory pools task-shared, so a single pool instance is reused across all native execution contexts within the same Spark tasktotal_reserved_for_thread()andunregister_and_total()double-counted memory when multiple execution contexts shared the same poolArcHow are these changes tested?
Same tests as #3924. Verified native code compiles on the 0.14 branch after cherry-pick.