Skip to content

[SDK Sentinel] Fix custom slot supplier GC teardown crash - #569

Open
sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/ruby/33931891751-1-b8a8d6d7e74f
Open

[SDK Sentinel] Fix custom slot supplier GC teardown crash#569
sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/ruby/33931891751-1-b8a8d6d7e74f

Conversation

@sdk-sentinel-bot

Copy link
Copy Markdown

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 BoxValue destruction 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-reproduction

  • Flake confidence: high
  • Fix confidence: high
  • Value: medium
  • Patch scope: standard — 1 changed file; 2.9 KiB
  • Local reproduction: not-reproduced — Six pre-change focused runs passed without reproducing the rare VM crash; one run showed a non-fatal worker-finalization timing warning.
  • Regression coverage: pass-after-only — Existing custom slot supplier coverage passed in 10 standard and five FIPS post-change stress attempts.
  • Unchanged baseline (RuboCop, Steep, Rust lint, and native compile) — passed
  • Independent candidate (RuboCop, Steep, Rust lint, and native compile) — passed

Investigator-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

  • Continuous Integration / build-lint-test (ubuntu-latest, 4.0, true)
  • Continuous Integration / build-lint-test matrix for Ubuntu and macOS with Ruby 3.3 and 4.0

Residual risks

  • Natural crash reproduction was not achieved, so validation relies on the native causal stack and stress coverage.
  • Values deferred after the final Ruby operation remain retained until another SendSyncBoxValue is created or the process exits.

Automation provenance

If this finding should not be fixed, apply the sdk-sentinel:false-positive label and close the PR. Sentinel will suppress the finding until its affected source changes.

SDK Sentinel recurrence history

  • Unique failed CI run attempts: 1
  • First occurrence: 2026-09-04 20:18 UTC
  • Latest occurrence: 2026-09-04 20:18 UTC
  • Recent occurrences:

@sdk-sentinel-bot
sdk-sentinel-bot requested a review from a team as a code owner September 5, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant