[
https://issues.apache.org/jira/browse/ZOOKEEPER-5121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140347#comment-18140347
]
Andrew Kyle Purtell commented on ZOOKEEPER-5121:
------------------------------------------------
I found another issue in this part of the code. A new JIRA and PR for it would
be a lot for a one line change and a conflict with the changes here, so have
included it here. Double server cursor advancement during failover would cause
a starvation because the advancement is fumbled. The PR has an addendum commit
covering this case. There are a few more lines due to the addition of comments
and a new test :-)
> (C client) DNS lookup failures can disrupt the client
> -----------------------------------------------------
>
> Key: ZOOKEEPER-5121
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5121
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Reporter: Andrew Kyle Purtell
> Assignee: Andrew Kyle Purtell
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {panel}
> The C client resolves server addresses synchronously inside its main I/O
> loop. When a DNS lookup fails, the loop exits without sending heartbeats or
> attempting to reconnect. It also leaves output parameters uninitialized,
> feeding invalid state into {{{}poll(){}}}. Brief DNS blips can silently
> expire healthy sessions and prevent disconnected clients from falling back to
> known addresses.
> The proposed fix decouples address re-resolution into a rate-limited periodic
> refresh. If a lookup fails, the client retains and uses its cached server
> addresses, reserving hard resolver errors strictly for initial setup calls
> ({{{}zookeeper_init{}}} and {{{}zoo_set_servers{}}}).
> The event loop now guarantees safe fallback outputs on any early return,
> preventing poll corruption.
> A new test verifies that heartbeats, timeouts, and reconnection attempts
> continue uninterrupted throughout simulated DNS outages.
> {panel}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)