ClickHouse/programs/server
Azat Khuzhin f15a5461be Fix server reload on port change (do not wait for current connections)
If you will execute 'SYSTEM RELOAD CONFIG' via, i.e., TCP protocol, then
reload on port change will endlessly wait for connection from which this
query had been issued, and you will see the following message in the
logs:

    2022.04.28 03:34:57.552513 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Debug> executeQuery: (from 127.0.0.1:11774) system reload config
    ...
    2022.04.28 03:34:57.710640 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Information> Application: Stopped listening for http://127.0.0.1:18123
    2022.04.28 03:34:57.798774 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Information> Application: Stopped listening for native protocol (tcp): 127.0.0.1:19000
    ...
    2022.04.28 03:34:57.901375 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Debug> Application: Server finished: http://127.0.0.1:18123
    2022.04.28 03:34:57.901455 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Trace> Application: Waiting server to finish: native protocol (tcp): 127.0.0.1:19000
    2022.04.28 03:34:58.001717 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Trace> Application: Waiting server to finish: native protocol (tcp): 127.0.0.1:19000
    2022.04.28 03:34:58.101881 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Trace> Application: Waiting server to finish: native protocol (tcp): 127.0.0.1:19000
    ...
    2022.04.28 03:35:01.707951 [ 37101 ] {b41d855c-4dbf-470a-a144-c6ae5a1abda8} <Trace> Application: Waiting server to finish: native protocol (tcp): 127.0.0.1:19000

But waiting for the current connection will never ends.

So instead of waiting directly from the query context (SYSTEM RELOAD
CONFIG) do this in background (actually not even in background, but
check on server reload and on exit).

v0: just don't wait for the servers
v2: fix use-after-free by removing dependency from server in handlers
v3: wait servers in background to avoid use-after-free of the context
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-16 16:22:58 +03:00
..
config.d Remove metric_log/part_log overrides in tests (enabled by default) 2021-11-03 08:39:36 +03:00
users.d Change <yandex> to <clickhouse> in configs 2021-09-20 01:38:53 +03:00
.gitignore Update gitignore 2021-04-20 23:39:41 +03:00
clickhouse-server.cpp Rename "common" to "base" 2021-10-02 10:13:14 +03:00
CMakeLists.txt Cleanup jemalloc contrib 2022-01-20 10:02:03 +03:00
config.xml Merge pull request #36997 from vitlibar/users-without-assigned-policies-can-view-rows 2022-05-09 12:04:50 +02:00
config.yaml.example Fix certs (finishing pr #36457) (#36747) 2022-05-01 12:59:19 +02:00
embedded.xml Change <yandex> to <clickhouse> in configs 2021-09-20 01:38:53 +03:00
MetricsTransmitter.cpp base should not depend on Common 2022-04-29 10:26:35 +08:00
MetricsTransmitter.h Move all folders inside /dbms one level up (#9974) 2020-04-02 02:51:21 +03:00
play.html Remove height restrictions from the query div in play web tool. 2022-05-09 13:32:26 -04:00
Server.cpp Fix server reload on port change (do not wait for current connections) 2022-05-16 16:22:58 +03:00
Server.h Fix server reload on port change (do not wait for current connections) 2022-05-16 16:22:58 +03:00
users.xml Merge branch 'master' into enable-memory-overcommit 2022-04-05 14:46:18 +00:00
users.yaml.example Update examples and remove obsolete embedded dictionaries from configs 2022-04-03 01:21:48 +02:00