Repository navigation
fix(local): reject equal HTTP/TCP ports and count only ClickHouse servers on start (#1452) - #1457
Merged
sdairs merged 1 commit intoNov 16, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why:
--http-portand--tcp-portonlocal clickhouse startexited0because the readiness probe checked HTTP/pingonhttp_portand TCP connectability ontcp_port, both satisfied by the single bound HTTP listener while the native TCP listener failed inserver.log. Likewise,resolve_portscould assign an omitted port onto the port claimed by the other listener (such as--http-port 9000or--tcp-port 8123).advisory_running_server_count_lockedpassedengine: None, solocal clickhouse startinspected and counted running Docker Postgres instances in its"already running"note.What:
--http-portand--tcp-portvalues atstart_serverentry (and inresolve_ports) as anArgumentConflictusage error (exit2) before scanning processes, locking metadata, or downloading a build.resolve_portsso an omitted port skips any port claimed by the other listener, both at default selection and when scanning for a free port.Some(Engine::Clickhouse)inadvisory_running_server_count_lockedsolocal clickhouse startcounts only running ClickHouse servers and does not inspect Postgres containers.docs/guides/local-development.md.QA:
cargo fmt --all --check,cargo clippy -p clickhousectl --all-targets -- -D warnings(default and--no-default-features), andcargo test -p clickhousectl.Risks: Low. Equal explicit HTTP and TCP ports could never produce a working native TCP listener; counting only ClickHouse servers matches the
clickhousectl local clickhouse listhint printed by the note.Closes #1452
Note
Low Risk
Targeted CLI validation and port-selection logic in local dev; no auth, data, or production-path changes.
Overview
local clickhouse startnow rejects identical--http-portand--tcp-portas a usage error (exit2) at the very beginning ofstart, before recovery, locks, downloads, or any.clickhousestate is touched.Port resolution was tightened:
resolve_portsrefuses the same explicit port for both listeners, and when one port is omitted the auto-picker never assigns the port already claimed by the other listener (explicit or resolved). That avoids readiness passing on HTTP alone while native TCP never binds.The informational “already running” note on start now counts only running ClickHouse servers, so Postgres metadata no longer triggers Docker container inspect during a ClickHouse start.
Docs note that HTTP and TCP ports must differ; tests cover conflict timing, omitted-port selection, and no Postgres inspect on ClickHouse start.
Reviewed by Cursor Bugbot for commit e13a778. Bugbot is set up for automated code reviews on this repo. Configure here.