fix: avoid panic when attempting to use test server across fork#408
Merged
chris-olszewski merged 3 commits intomainfrom Apr 1, 2026
Merged
fix: avoid panic when attempting to use test server across fork#408chris-olszewski merged 3 commits intomainfrom
chris-olszewski merged 3 commits intomainfrom
Conversation
Reproduces temporalio/samples-ruby#78: when a process forks after a Temporal runtime is created (e.g., Rails parallelize) and the child exits with `exit` (triggering Ruby's object finalization), the Rust Drop for CoreRuntime tries to shut down Tokio, which wakes the I/O driver using inherited (now invalid) kqueue/epoll FDs — causing a panic: "failed to wake I/O driver: Bad file descriptor". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> squash
mjameswh
approved these changes
Apr 1, 2026
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 was changed
Avoid dropping the tokio runtime if we're in a fork.
Why?
We document that objects that hold this runtime handle cannot be used across threads and throw specific errors explaining this if it is attempted
sdk-ruby/temporalio/test/client_test.rb
Lines 155 to 167 in 1cda7a1
The issue is that these useful errors can be hidden by a panic from dropping the runtime handle which allows the expected errors to surface to users.
Checklist
Closes [Bug] Parallel test configuration in Rails causes crash #407
How was this tested:
Initial commit added failing test. Tested with Configure parallel tests in rails app (which doesn't work - yet) samples-ruby#78 (review) and verified that the errors explaining invalid usage across forks are now displayed instead of a panic.
Any docs updates needed?
N/A