Skip to content

Fork children from a clean fiber - #76

Merged
samuel-williams-shopify merged 5 commits into
mainfrom
fork-from-fiber
Jul 29, 2026
Merged

Fork children from a clean fiber#76
samuel-williams-shopify merged 5 commits into
mainfrom
fork-from-fiber

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

  • Replace the short-lived native thread used for Process.fork with a blocking Fiber.
  • Keep fork on the caller's native thread for compatibility with native libraries such as gRPC.
  • Preserve the clean child stack: CRuby promotes the current Fiber to the child root and clears its resuming Fiber after fork.
  • Add a regression test proving objects retained only by the caller stack can be collected in the child.

CRuby behavior: https://bugs.ruby-lang.org/issues/15041

Testing

  • ruby -Ilib .../sus test/async/container/forked.rb
  • 30 tests, 60 assertions passed.
  • Ruby syntax and git diff --check passed.

Assisted-By: devx/c6ee7ea7-0359-4ed9-8642-b8a4adc29316
Assisted-By: devx/c6ee7ea7-0359-4ed9-8642-b8a4adc29316
Assisted-By: devx/c6ee7ea7-0359-4ed9-8642-b8a4adc29316
Assisted-By: devx/c6ee7ea7-0359-4ed9-8642-b8a4adc29316
Assisted-By: devx/c6ee7ea7-0359-4ed9-8642-b8a4adc29316
@samuel-williams-shopify
samuel-williams-shopify merged commit f91dc01 into main Jul 29, 2026
34 of 40 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the fork-from-fiber branch July 29, 2026 09:30
ioquatix pushed a commit that referenced this pull request Jul 29, 2026
ioquatix pushed a commit that referenced this pull request Jul 29, 2026
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