Automated fix for refs/heads/rwstauner/ares-resolver-fork-crash - #47
Open
github-actions[bot] wants to merge 2 commits into
Open
Automated fix for refs/heads/rwstauner/ares-resolver-fork-crash#47github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
Fix a crash in AresResolver::~AresResolver() that occurs when Reset() is called via ReinitHandle during fork, followed by the resolver being destroyed without a subsequent Restart(). This can be triggered by Process._fork hooks in ruby code that shut down gRPC resources during fork. The fork handler calls Reset() on resolvers, which destroys channel_ and sets it to nullptr. If the application then tears down the resolver (Orphan) before Restart() runs, the destructor fires with channel_ == nullptr and hits GRPC_CHECK_NE(channel_, nullptr) -> SIGABRT. The fix replaces the unconditional CHECK with a conditional: only call ares_destroy() if channel_ is non-null. This is safe because Reset() already calls ares_destroy() before nullifying channel_. Includes regression tests: - C++ test: ares_resolver_fork_safety_test (Reset then Orphan without Restart, both with and without pending DNS lookups) - Ruby end2end test: concurrent_close_during_fork_test (channels destroyed on background thread during Process._fork)
rwstauner
force-pushed
the
rwstauner/ares-resolver-fork-crash
branch
from
April 13, 2026 19:00
a5e30b7 to
e36d2db
Compare
rwstauner
force-pushed
the
rwstauner/ares-resolver-fork-crash
branch
4 times, most recently
from
June 10, 2026 20:57
e84899b to
54fe2da
Compare
rwstauner
force-pushed
the
rwstauner/ares-resolver-fork-crash
branch
from
June 16, 2026 02:48
54fe2da to
a5f6dba
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.
PanCakes to the rescue!
We noticed that our 'sanity' test was going to fail, but we think we can fix that automatically, so we put together this PR to do just that!
If you'd like to opt-out of these PR's, add yourself to NO_AUTOFIX_USERS in .github/workflows/pr-auto-fix.yaml