Repository navigation
feat(grpc): optional multi-backend DNS expand and periodic re-resolve - #147
songzhendong wants to merge 6 commits into
Conversation
When SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY is set, expand comma-separated hostname backends to A/AAAA, re-resolve on an interval, and rebuild the channel when the merged dial set changes. Failed names keep last-known endpoints; interval values must be whole positive integers (overflow and invalid strings fall back to 30s); incomplete/empty DNS logs are throttled.
|
Reviewed commit
Validation: all 81 remote unit tests passed, and the changed source files passed ESLint. The local gRPC checks above reproduced the routing and missing-outage-log issues; an active streaming RPC survived channel replacement in the focused check. Docker/OAP e2e was not validated locally. |
…NS throttle Preserve HTTP/2 default_authority after DNS expand on plaintext; emit an outage log when a rebuild replacement never becomes READY; throttle per-lookup DNS errors in BackendAddressResolver.
Keep plaintext default_authority when a TLS-only sslTargetNameOverride is set; retain rebuild status-log suppress across consecutive rebuilds while already DISCONNECT so failed replacements still emit an outage log.
Split DnsAuthority into host:port for grpc.default_authority and hostname-only for TLS SNI, matching sw-static pre-expand authority.
Ignore updateResolution and pending nextTick deliveries once destroy() runs so boot→immediate shutdown cannot reconnect a closed channel.
Reuse the pending getaddrinfo promise per hostname so a 5s wait timeout cannot stack another libc query on every periodic tick.
|
Thanks for the review. We verified the reported issues and fixed them, plus a few follow-up edge cases found while hardening the same paths. Fixes for review comments
Follow-up bugs found and fixed
Notes
|
|
Re-reviewed at
Validation: all 86 remote unit tests pass with proxy variables unset (85/86 with |
Summary
Add optional multi-backend DNS expand and periodic re-resolve for comma-separated OAP collector addresses.
SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY/isResolveDnsPeriodically(defaultfalse). Also acceptsSW_AGENT_COLLECTOR_IS_RESOLVE_DNS_PERIODICALLY.sw-static, re-resolve on an interval (default 30s; override withSW_AGENT_DNS_RE_RESOLVE_INTERVAL_SECONDS, also acceptsSW_AGENT_COLLECTOR_GRPC_CHANNEL_CHECK_INTERVAL).tests/remote-e2e/dns-periodic/) + CI jobTestRemoteE2EDnsPeriodic.New / related configuration
agent.start()optionSW_AGENT_IS_RESOLVE_DNS_PERIODICALLYisResolveDnsPeriodicallyfalseSW_AGENT_DNS_RE_RESOLVE_INTERVAL_SECONDS30Bugs fixed during review (by severity)
No P0 defects were left open on tip. Issues below were found in review of this feature and fixed before merge.
P1
CONNECTEDdid not force listener teardown; Trace/Meter/Management kept stubs on the shut-down channelDISCONNECT→CONNECTEDon rebuild so listeners recreate stubsP2
DISCONNECTeven with a usable prior channelENOTFOUND) used success-only endpoints and could shrink the dial set / flap[], no throw) did not count as incomplete expand → same shrink/flap classTRANSIENT_FAILUREand another name's IP changedDISCONNECT→CONNECTEDspam / mute window wrong for async READYunhandledRejectionwarn/errorP3
seconds * 1000 > 2^31-1parseIntaccepted1.5/1e3/10junkdespite docs saying invalid → 30/^\d+$//tests/remote-e2e/ignore (would pull in Docker e2e)build-and-test.mdwith CI ignore patternsTest plan
tests/remote/BackendAddressResolver.test.ts,tests/remote/GRPCChannelManager.test.tstests/remote-e2e/dns-periodic/(multi-IP via socat; interval / rebuild proof)TestRemoteE2EDnsPeriodicon Node 20/22/24host:portstill grpc-jsdns:1.5/1e3/10junk→ stay 30sNotes for reviewers
sw-statictargets can pick up DNS changes without waiting for a disconnect.