[AURON #1803] fix possible deadlock in OnHeapSpillManager#1804
Merged
Conversation
c94b18b to
a864da9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a potential deadlock in the OnHeapSpillManager by improving synchronization between OnHeapSpill and SparkOnHeapSpillManager. The deadlock could occur when an OnHeapSpill.write() operation holds a lock while calling acquireMemory(), which in turn triggers SparkOnHeapSpillManager.spill() that attempts to acquire the same lock again.
Key Changes:
- Replaced intrinsic
synchronizedlocks with explicitReentrantLockfor better control over lock acquisition - Added a
triggerparameter to thespill()method to identify the initiatingMemoryConsumer - Implemented deadlock prevention logic using
tryLock()when the spilling is triggered by the sameSparkOnHeapSpillManagerinstance
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| OnHeapSpill.scala | Replaces synchronized blocks with ReentrantLock, adds trigger parameter to spill() method with tryLock logic to prevent deadlock when spilling is triggered by the same thread |
| SparkOnHeapSpillManager.scala | Updates call to spill.spill() to pass the trigger parameter that identifies which MemoryConsumer initiated the spilling operation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cxzl25
approved these changes
Dec 31, 2025
ShreyeshArangath
approved these changes
Dec 31, 2025
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?
Closes #1803
Rationale for this change
What changes are included in this PR?
Fixes possible synchronize block confliction in OnHeapSpillManager
Are there any user-facing changes?
No.
How was this patch tested?
Rerun the online buggy query many times to verify that the bug has gone.