Skip to content

Fix Client::login segfault on empty hosts_and_ports (#103603)#1696

Open
BorisTyshkevich wants to merge 2 commits intoantalya-26.1from
pr1-client-login-empty-hosts
Open

Fix Client::login segfault on empty hosts_and_ports (#103603)#1696
BorisTyshkevich wants to merge 2 commits intoantalya-26.1from
pr1-client-login-empty-hosts

Conversation

@BorisTyshkevich
Copy link
Copy Markdown
Collaborator

Summary

Client::login dereferenced hosts_and_ports.front().host unconditionally, but hosts_and_ports 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 front() 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 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

  • Build clean against antalya-26.1
  • clickhouse client --connection X (where X has no <host> resolved into hosts_and_ports) no longer crashes; reaches the OAuth flow as designed
  • Behavior unchanged when --host is explicit (vector is non-empty, takes the original path)

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Workflow [PR], commit [288a897]

Signed-off-by: Boris Tyshkevich <btyshkevich@altinity.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants