{"record":{"id":"f0109c749cad442c","repo":"t8y2/dbx","slug":"no-reachable-zookeeper-server-within-dms-s","errorCode":null,"errorMessage":"No reachable ZooKeeper server within %dms: %s","messagePattern":"No reachable ZooKeeper server within (.+?)ms: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"agents/drivers/zookeeper/connection.go","lineNumber":429,"sourceCode":"\t\t\tselect {\n\t\t\tcase jobs <- server:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\tdone := make(chan struct{})\n\tgo func() {\n\t\twaitGroup.Wait()\n\t\tclose(done)\n\t}()\n\tselect {\n\tcase <-reachable:\n\t\treturn nil\n\tcase <-done:\n\tcase <-ctx.Done():\n\t}\n\treturn fmt.Errorf(\"No reachable ZooKeeper server within %dms: %s\", timeout.Milliseconds(), strings.Join(servers, \",\"))\n}\n\nfunc endpointAddress(endpoint string) (string, error) {\n\tvalue := strings.TrimSpace(endpoint)\n\tif strings.HasPrefix(value, \"[\") {\n\t\tif _, _, err := net.SplitHostPort(value); err == nil {\n\t\t\treturn value, nil\n\t\t}\n\t\treturn value + \":\" + strconv.Itoa(defaultPort), nil\n\t}\n\tif strings.Count(value, \":\") == 0 {\n\t\treturn net.JoinHostPort(value, strconv.Itoa(defaultPort)), nil\n\t}\n\tif strings.Count(value, \":\") == 1 {\n\t\tif _, _, err := net.SplitHostPort(value); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn value, nil","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/zookeeper/connection.go#L411-L447","documentation":"requireReachableServer probes the configured server endpoints under a timeout context; if none of them accept a TCP connection before the deadline or the context is cancelled, the driver aborts connection setup with this error listing the timeout and all attempted servers.","triggerScenarios":"Calling connect/openClient where every host:port in the server list is unreachable (connection refused, DNS failure, firewall) or too slow, within the configured connection timeout.","commonSituations":"Wrong host or port in the connection string, ZooKeeper ensemble down or restarting, network/firewall blocking the client port (2181), or timeout set too low for a slow network.","solutions":["Verify each server address and port (default 2181) is correct and reachable: nc -zv host 2181.","Check the ZooKeeper ensemble is running (zServer status) and not in a failed/quorum-lost state.","Increase the connection timeout if the network is slow or servers are slow to accept.","Check firewalls/VPNs/security groups between client and servers; confirm DNS resolves the hostnames."],"exampleFix":"// before\ndsn := \"zookeeper://zk1.internal:2182,zk2.internal:2182\"\n// after\ndsn := \"zookeeper://zk1.internal:2181,zk2.internal:2181\" // correct client port","handlingStrategy":"retry","validationCode":"for _, ep := range strings.Split(serverList, \",\") {\n\tconn, err := net.DialTimeout(\"tcp\", normalizeEndpoint(ep), 3*time.Second)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"precheck: %s unreachable: %v\", ep, err)\n\t}\n\tconn.Close()\n}","typeGuard":null,"tryCatchPattern":"var sess *clientSession\nerr := retry.Do(3, 2*time.Second, func() error {\n\ts, err := connect(cfg)\n\tif err != nil && strings.Contains(err.Error(), \"No reachable ZooKeeper server\") {\n\t\treturn retry.Retryable(err) // transient network; retry with backoff\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tsess = s\n\treturn nil\n})","preventionTips":["Precheck TCP reachability of every host:port before connecting.","Monitor the ensemble's quorum health (e.g. 'stat' four-letter word).","Use a realistic timeout for your network latency.","List multiple servers so one failure doesn't block connect."],"tags":["zookeeper","network","timeout"],"backgroundTag":"no-reachable-server","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}