[VL] Fix native SIGSEGV in ~ObjectStore when release() races with store destruction - #12740
Open
yikf wants to merge 1 commit into
Open
[VL] Fix native SIGSEGV in ~ObjectStore when release() races with store destruction#12740yikf wants to merge 1 commit into
yikf wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a native SIGSEGV in gluten::ObjectStore::~ObjectStore() caused by a TOCTOU race where aliveObjects_.empty() was checked outside mtx_ and aliveObjects_.rbegin() was used inside mtx_, allowing a concurrent ObjectStore::release() to empty the map in-between and trigger UB.
Changes:
- Move
aliveObjects_.empty()check undermtx_in~ObjectStore()to make the empty-check + last-element pop atomic. - Add an in-code concurrency explanation documenting the race and crash mechanism.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
zhztheplayer
approved these changes
Aug 10, 2026
yikf
force-pushed
the
fix-script-transform-runtime-release-race
branch
from
August 10, 2026 13:09
aa29b4c to
9e6d27e
Compare
yikf
force-pushed
the
fix-script-transform-runtime-release-race
branch
from
August 10, 2026 13:09
9e6d27e to
681dc9b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
cpp/core/utils/ObjectStore.cc:52
- There is trailing whitespace at the end of this comment line, which can cause unnecessary diffs and may fail whitespace/formatting checks.
// The empty-check and the pop of the last alive object must be atomic under `mtx_`.
yikf
force-pushed
the
fix-script-transform-runtime-release-race
branch
from
August 10, 2026 13:16
681dc9b to
cdb556a
Compare
yikf
force-pushed
the
fix-script-transform-runtime-release-race
branch
from
August 11, 2026 07:24
cdb556a to
2096455
Compare
yikf
force-pushed
the
fix-script-transform-runtime-release-race
branch
from
August 11, 2026 08:05
2096455 to
0bff6bb
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.
What changes are proposed in this pull request?
~ObjectStore()checkedaliveObjects_.empty()outside the lock and then readaliveObjects_.rbegin()inside the lock. While a store is being destructed, another thread can still call the staticObjectStore::release()(e.g. a script-transformation feed thread closing its output iterator during task teardown), which erases entries fromaliveObjects_under the lock. A concurrent erase could empty the map between the unlocked check andrbegin(), sorbegin()dereferences an empty tree and crashes the JVM with a native SIGSEGV instd::_Rb_tree_decrement.Fix: move the empty-check under the lock so it is atomic with popping the last object.
Surfaced as a flaky native crash in CI running
GlutenSparkScriptTransformationSuite:From
hs_err_pid*.log:How was this patch tested?
flaky test, existed test to verify.
Was this patch authored or co-authored using generative AI tooling?
Yes, AI-assisted, Generated-by: Claude claude-opus-4-8.