Andrew Kyle Purtell created ZOOKEEPER-5121:
----------------------------------------------
Summary: (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
{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 fix is to decouple address 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)