Skip to content

Automated fix for refs/heads/rwstauner/ares-resolver-fork-crash - #47

Open
github-actions[bot] wants to merge 2 commits into
rwstauner/ares-resolver-fork-crashfrom
create-pull-request/patch-a5e30b7
Open

Automated fix for refs/heads/rwstauner/ares-resolver-fork-crash#47
github-actions[bot] wants to merge 2 commits into
rwstauner/ares-resolver-fork-crashfrom
create-pull-request/patch-a5e30b7

Conversation

@github-actions

Copy link
Copy Markdown

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

rwstauner and others added 2 commits March 30, 2026 16:15
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
rwstauner force-pushed the rwstauner/ares-resolver-fork-crash branch from a5e30b7 to e36d2db Compare April 13, 2026 19:00
@rwstauner
rwstauner force-pushed the rwstauner/ares-resolver-fork-crash branch 4 times, most recently from e84899b to 54fe2da Compare June 10, 2026 20:57
@rwstauner
rwstauner force-pushed the rwstauner/ares-resolver-fork-crash branch from 54fe2da to a5f6dba Compare June 16, 2026 02:48
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