Repository navigation
Conversation
On macOS, calling shutdown() on an already-disconnected socket returns
ENOTCONN (errno 57). Poco::Net::SocketImpl::shutdown() turns any non-zero
return into a NetException("Socket is not connected"). In
Coordination::ZooKeeper::finalize() the socket.shutdown() call is wrapped in
try/catch and the exception is logged via tryLogCurrentException(log), which
defaults to ERROR level. keeper-client in query mode sends ERROR logs to
stderr, so at process exit this benign teardown noise lands on stderr.
This makes the stateless test 03135_keeper_client_find_commands fail on
Fast test (arm_darwin) only: the command output is correct, but the test
harness treats any stderr ("having stderror") as a failure. It is a low
frequency, macOS-only flaky across unrelated PRs (0 master failures).
Downgrade the ENOTCONN case to TRACE at both socket.shutdown() catch sites
(finalize teardown and the connect-failure cleanup path), keeping ERROR for
all other shutdown errors. This mirrors the existing precedent in
HTTPServerConnection.cpp, which already checks e.code() == POCO_ENOTCONN and
logs at a lower level to avoid spamming logs with benign disconnect noise.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-2:20260614-072200 |
|
cc @antonio2368 @alesapin could you review this? It downgrades the benign macOS |
|
Workflow [PR], commit [69afd49] Summary: ❌
AI ReviewSummaryThis PR narrows PR Metadata
Final VerdictStatus: ✅ Approve |
|
CI finished on ee14923. Disposition of the only red:
The target test of this PR, |
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 6/14 (42.86%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 8 line(s) · Uncovered code |
CI finish ledger — 69afd49CI fully finished (Finish Workflow pass). The sole failure is a chronic trunk AST-fuzzer logical error, unrelated to this ZooKeeper-finalize logging change.
Session id: cron:our-pr-ci-monitor:20260703-053000 |
695b499
…shutdown-enotconn-stderr Do not log benign ENOTCONN on socket shutdown during ZooKeeper finalize
Related: #100651
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Stop logging a benign
Net Exception: Socket is not connectederror duringZooKeepersession finalize on macOS.clickhouse keeper-clientno longer prints this spurious error to stderr at exit.Description
On macOS,
shutdown()on an already-disconnected socket returnsENOTCONN(errno 57).Poco::Net::SocketImpl::shutdown()converts any non-zero return intoNetException("Socket is not connected"). InCoordination::ZooKeeper::finalize()thesocket.shutdown()call is wrapped in try/catch and logged viatryLogCurrentException(log), which defaults to ERROR.keeper-clientin query mode sends ERROR logs to stderr, so at process exit this benign teardown noise lands on stderr.This is what makes the keeper-client
Fast test (arm_darwin)tests fail intermittently (03135_keeper_client_find_commands,03230_keeper_cp_mv_commands,03231_keeper_cpr_mvr_commands,03988_keeper_client_autocomplete): the command output is correct, but the test harness treats any stderr as a failure. It is a low-frequency, macOS-only flaky across unrelated PRs (0 master failures).This downgrades the
ENOTCONNcase to TRACE at bothsocket.shutdown()catch sites (finalize teardown and the connect-failure cleanup path), keeping ERROR for all other shutdown errors. It mirrors the existing precedent inHTTPServerConnection.cpp, which already checkse.code() == POCO_ENOTCONNand logs at a lower level.Reported by alexey-milovidov in #100651. arm_darwin is macOS, so the ENOTCONN path does not reproduce on the Linux build box; the change is backed by the CI report stack traces and an in-tree precedent. Verified on Linux that the normal keeper-client teardown path produces no stderr (no regression).
CI report (Fast test (arm_darwin), PR #100651): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100651&sha=5370da39b454d590a5639759af8d993f1f5b4663&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
Version info
26.7.1.581(included in26.7and later)