[SDK Sentinel] Fix custom slot supplier GC teardown crash - #569
Open
sdk-sentinel-bot wants to merge 1 commit into
Conversation
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.
Caution
This PR contains untrusted AI-generated code. Do not approve or run CI until a maintainer has reviewed the diff. SDK Sentinel verified that GitHub Actions remained approval-gated with zero executable jobs when this PR was opened.
Summary
Prevent a Ruby 4.0 FIPS worker-suite process crash seen in the [first captured target-branch failure](https://github.com/temporalio/sdk-ruby/actions/runs/33914370027), after [earlier equivalent successful CI](https://github.com/temporalio/sdk-ruby/actions/runs/33911088056). The following target-branch CI also passed without relevant bridge changes.
Root cause
Custom slot permits retain Ruby objects in
BoxValue. Core can release the final permit reference while completing a local activity on a Tokio thread. Its destructor then calls Ruby's GC unregister API outside a Ruby thread, matching the native crash stack and an established repository failure mode.Fix
Defer foreign-thread
BoxValuedestruction in a process-wide queue. The next Ruby-thread creation drains the queue, ensuring GC unregister operations run in a valid Ruby context and removing the thread-scheduling nondeterminism.Validation
The unchanged baseline and candidate canonical validator passed. Ten standard and five FIPS focused stress attempts passed. The rare crash did not reproduce locally; final deferred values may remain retained until another boxed value is created or process exit.
Validation status:
validated-without-reproductionhighhighmediumstandard— 1 changed file; 2.9 KiBnot-reproduced— Six pre-change focused runs passed without reproducing the rare VM crash; one run showed a non-fatal worker-finalization timing warning.pass-after-only— Existing custom slot supplier coverage passed in 10 standard and five FIPS post-change stress attempts.RuboCop, Steep, Rust lint, and native compile) — passedRuboCop, Steep, Rust lint, and native compile) — passedInvestigator-run checks
bundle exec rake test TESTOPTS="--name=/custom_slot_supplier/"— passed; 6 attempt(s). Pre-change attempts passed; the rare crash was not reproduced naturally.for attempt in 1 2 3 4 5 6 7 8 9 10; do bundle exec rake test TESTOPTS="--name=/custom_slot_supplier/" \|\| exit 1; done— passed; 10 attempt(s). All 60 post-change standard-mode focused cases passed.for attempt in 1 2 3 4 5; do CARGO_NET_OFFLINE=true TEMPORALIO_FIPS=1 bundle exec rake test TESTOPTS="--name=/custom_slot_supplier/" \|\| exit 1; done— passed; 5 attempt(s). All 30 Ruby 4.0 FIPS-mode focused cases passed..ci-flake-runtime/input/validate.sh— passed; 1 attempt(s). The trusted unchanged baseline passed RuboCop, Steep, Rust lint/format, and native compilation..ci-flake-runtime/input/validate.sh— passed; 1 attempt(s). The candidate passed the same canonical validator.TEMPORALIO_FIPS=1 bundle exec rake compile— passed; 1 attempt(s). The exact FIPS native bridge configuration compiled successfully.Required target CI
Residual risks
Automation provenance
d2dee2eebc252a1594f4c17d047be900e357d3b2If this finding should not be fixed, apply the
sdk-sentinel:false-positivelabel and close the PR. Sentinel will suppress the finding until its affected source changes.SDK Sentinel recurrence history
2026-09-04 20:18 UTC2026-09-04 20:18 UTC