mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
After `safeExit` (forceful shutdown due to stuck client connections), the kernel may still be cleaning up sockets, especially under sanitizer builds where `SYS_exit_group` is used. The `safeExit` path skips the normal `SCOPE_EXIT_SAFE` handler that closes interserver (9009) and Keeper (9181) listening sockets, leaving them to kernel cleanup which can race with the next server start. Add `wait_server_port_free` to check port availability before starting, so `start_server` waits for ports 9000, 9009, and 9181 to be released. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98454&sha=48200cc58dec962ea1624acc23da4372e73fa52c&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>