dns_resolver: harden Hickory config creation and resolve null-FFI paths#45106
Open
agrawroh wants to merge 1 commit into
Open
dns_resolver: harden Hickory config creation and resolve null-FFI paths#45106agrawroh wants to merge 1 commit into
agrawroh wants to merge 1 commit into
Conversation
Replaces process-aborting ``RELEASE_ASSERT`` calls in ``HickoryDnsResolverConfig::create()`` with ``absl::StatusOr`` returns so operators see configuration errors as factory failures instead of crashes: - Dynamic module load failure. - ABI symbol resolution failure. - ``HickoryDnsResolverConfig`` JSON serialization failure. - Rust-side rejection of the configuration JSON. The ``HickoryDnsResolverConfig`` destructor now null-guards both fields it consults, so unwinding a partially-constructed instance from a failed ``create()`` no longer crashes by calling through a null destroy FFI or passing null into the Rust SDK's destroy macro. The per-query ``on_dns_resolve`` FFI returning null (Rust panic or ``DnsResolverInstance::resolve`` returning ``None``) now invokes the user callback synchronously with ``Failure``, increments ``resolve_total`` and ``get_addr_failure`` to mirror the asynchronous completion accounting, and returns a null query handle. Previously the path was guarded by a debug-only ``ASSERT`` that was stripped in production builds. The ``HickoryDnsResolver`` constructor changes the same-shaped ``ASSERT`` on ``resolver_module_ptr_`` to ``RELEASE_ASSERT`` so production builds also fail loudly on a Rust panic during resolver creation, rather than continuing into undefined behavior. Adds tests for the new synchronous-failure metric accounting and the destructor null-guard. Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
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.
Description
This PR converts several fail-stop paths in the Hickory DNS resolver shell into observable, recoverable failures.
Commit Message: dns_resolver: harden Hickory config creation and resolve null-FFI paths
Additional Description: Converts several fail-stop paths in the Hickory DNS resolver shell into observable, recoverable failures.
Risk Level: Low
Testing: Added Tests
Docs Changes: Added
Release Notes: Added