Skip to content

Fix IPv6 support in listen_host for ArrowFlight#86664

Merged
vitlibar merged 1 commit intoClickHouse:masterfrom
vitlibar:fix-ipv6-in-listen-host-for-arrow-flight
Sep 4, 2025
Merged

Fix IPv6 support in listen_host for ArrowFlight#86664
vitlibar merged 1 commit intoClickHouse:masterfrom
vitlibar:fix-ipv6-in-listen-host-for-arrow-flight

Conversation

@vitlibar
Copy link
Copy Markdown
Member

@vitlibar vitlibar commented Sep 4, 2025

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix support for IPv6 in listen_host for ArrowFlight.

Before this PR a server with the following lines in the config

<clickhouse>
    <arrowflight_port>8888</arrowflight_port>
    <listen_host>::</listen_host>
</clickhouse>

failed on startup with the following exception:

<Error> Application: std::exception. Code: 1001, type: std::runtime_error, e.what() = /clickhouse/contrib/arrow/cpp/src/arrow/result.cc:28: ValueOrDie called on an error: Invalid: Cannot parse URI: 'grpc+tcp://:::8888'
, Stack trace (when copying this message, always include the lines below):

0. /clickhouse/contrib/llvm-project/libcxx/include/__exception/exception.h:113: std::runtime_error::runtime_error(String const&)
1. /clickhouse/contrib/arrow/cpp/src/arrow/util/logging.cc:74: arrow::util::CerrLog::~CerrLog()
2. /clickhouse/contrib/arrow/cpp/src/arrow/util/logging.cc:69: arrow::util::CerrLog::~CerrLog()
3. /clickhouse/contrib/arrow/cpp/src/arrow/util/logging.cc:254: arrow::util::ArrowLog::~ArrowLog()
4. /clickhouse/contrib/arrow/cpp/src/arrow/result.cc:28: arrow::internal::DieWithMessage(String const&)
5. /clickhouse/contrib/arrow/cpp/src/arrow/result.cc:31: arrow::internal::InvalidValueOrDie(arrow::Status const&)
6. /clickhouse/contrib/arrow/cpp/src/arrow/result.h:322: DB::ArrowFlightHandler::start()
7. /clickhouse/src/Server/ProtocolServerAdapter.h:41: DB::Server::main(std::vector<String, std::allocator<String>> const&)
8. /clickhouse/base/poco/Util/src/Application.cpp:315: Poco::Util::Application::run()
9. /clickhouse/programs/server/Server.cpp:623: DB::Server::run()
10. /clickhouse/base/poco/Util/src/ServerApplication.cpp:131: Poco::Util::ServerApplication::run(int, char**)
11. /clickhouse/programs/server/Server.cpp:410: mainEntryClickHouseServer(int, char**)
12. /clickhouse/programs/main.cpp:381: main

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Sep 4, 2025

Workflow [PR], commit [12b0084]

Summary:

job_name test_name status info comment
Integration tests (amd_asan, old analyzer, 5/6) failure
test_concurrent_ttl_merges/test.py::test_no_ttl_merges_in_busy_pool FAIL
test_concurrent_ttl_merges/test.py::test_limited_ttl_merges_two_replicas FAIL
Integration tests (amd_binary, 4/5) failure
test_storage_s3_queue/test_4.py::test_list_and_delete_race FAIL
Finish Workflow failure
python3 ./ci/jobs/scripts/workflow_hooks/new_tests_check.py failure

@clickhouse-gh clickhouse-gh bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 4, 2025
@vitlibar vitlibar marked this pull request as ready for review September 4, 2025 11:02
@vitlibar vitlibar changed the title Fix IPv6 in listen_host for ArrowFlight Fix IPv6 support in listen_host for ArrowFlight Sep 4, 2025
auto port_to_listen = address_to_listen.port();

/// Function arrow::flight::Location::ForGrpc*() builds an URL based so it requires IPv6 address to be enclosed in brackets
String host_component = (ip_to_listen.family() == Poco::Net::AddressFamily::IPv6) ? ("[" + ip_to_listen.toString() + "]") : ip_to_listen.toString();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was here because an IPv6 address needs to be enclosed in brackets, we can't just insert it into URL, so the following is incorrect:

grpc+tcp://:::8888

(it should be grpc+tcp://[::]:8888)

@vitlibar
Copy link
Copy Markdown
Member Author

vitlibar commented Sep 4, 2025

Probably it would be worth adding a test, but our test system is not set up for using IPv6.

@evillique evillique self-assigned this Sep 4, 2025
@vitlibar vitlibar enabled auto-merge September 4, 2025 15:46
@vitlibar
Copy link
Copy Markdown
Member Author

vitlibar commented Sep 4, 2025

@vitlibar vitlibar added this pull request to the merge queue Sep 4, 2025
Merged via the queue into ClickHouse:master with commit d9b5f8c Sep 4, 2025
228 of 240 checks passed
@vitlibar vitlibar deleted the fix-ipv6-in-listen-host-for-arrow-flight branch September 4, 2025 22:00
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants