Fix Client::login segfault on empty hosts_and_ports (#103603)#1696
Open
BorisTyshkevich wants to merge 2 commits intoantalya-26.1from
Open
Fix Client::login segfault on empty hosts_and_ports (#103603)#1696BorisTyshkevich wants to merge 2 commits intoantalya-26.1from
BorisTyshkevich wants to merge 2 commits intoantalya-26.1from
Conversation
Client::login dereferenced hosts_and_ports.front() unconditionally, but
that vector is populated only from explicit --host. When the host comes
from --connection or top-level <host> in the client config, the vector
stays empty and the front() call SIGSEGVs in Client::main before any
OAuth round-trip happens.
Fall back to getClientConfiguration().getString("host", "") when the
vector is empty; that value is always set by this point because
initialize() resolves it from --host / --connection / config / env.
This is the upstream issue reported at
ClickHouse#103603 — same crash,
same fix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Boris Tyshkevich <btyshkevich@altinity.com>
7 tasks
Signed-off-by: Boris Tyshkevich <btyshkevich@altinity.com>
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.
Summary
Client::logindereferencedhosts_and_ports.front().hostunconditionally, buthosts_and_portsis populated only from explicit--host. When the host comes from--connectionor top-level<host>in the client config, the vector stays empty andfront()SIGSEGVs inClient::mainbefore any OAuth round-trip happens.Fall back to
getClientConfiguration().getString("host", "")when the vector is empty; that value is always set by this point becauseinitialize()resolves the host from--host/--connection/ config / env before reaching this code.This is the upstream issue tracked at ClickHouse#103603 — same crash, same fix. Worth porting upstream.
Test plan
antalya-26.1clickhouse client --connection X(where X has no<host>resolved intohosts_and_ports) no longer crashes; reaches the OAuth flow as designed--hostis explicit (vector is non-empty, takes the original path)🤖 Generated with Claude Code