mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
20dbf5eb34
In case of possible EINTR (i.e. query profiler) it is possible for select() from getReplicaForReading() (this is the stage when the initiator is waiting for Cancel packet from the remote shards, that can be sent in case of enough rows was read, or the query had been cancelled explicitly) to return without any sockets ready, and getReplicaForReading() will assume that the timeout happened. Here is a stacktrace example: [ 59205 ] {04f3d3a4-7346-4ef2-bf57-928f9e55ed89} <Error> TCPHandler: Code: 159. DB::Exception: Received from b8:9000. DB::Exception: Timeout (-1000 ms) exceeded while reading from . Stack trace: 0. Poco::Exception::Exception() @ 0x17e26eac in /usr/bin/clickhouse 1. DB::Exception::Exception() @ 0xb550b9a in /usr/bin/clickhouse 2. DB::Exception::Exception<>() @ 0x15ad1c81 in /usr/bin/clickhouse 3. DB::MultiplexedConnections::getReplicaForReading(bool) @ 0x15ad16fc in /usr/bin/clickhouse 4. DB::MultiplexedConnections::receivePacketUnlocked() @ 0x15ad02fd in /usr/bin/clickhouse 5. DB::MultiplexedConnections::drain() @ 0x15ad0df8 in /usr/bin/clickhouse 6. DB::ConnectionCollector::drainConnections(DB::IConnections&, bool) @ 0x1443c205 in /usr/bin/clickhouse 7. DB::RemoteQueryExecutor::finish() @ 0x1445ea6a in /usr/bin/clickhouse Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
22 lines
1.0 KiB
SQL
22 lines
1.0 KiB
SQL
-- This is a regression test for EINTR handling in MultiplexedConnections::getReplicaForReading()
|
|
|
|
select * from remote('127.{2,4}', view(
|
|
-- This is the emulation of the slow query, the server will return a line each 0.1 second
|
|
select sleep(0.1) from numbers(20) settings max_block_size=1)
|
|
)
|
|
-- LIMIT is to activate query cancellation in case of enough rows already read.
|
|
limit 10
|
|
settings
|
|
-- This is to avoid draining in background and got the exception during query execution
|
|
drain_timeout=-1,
|
|
-- This is to activate as much signals as possible to trigger EINTR
|
|
query_profiler_real_time_period_ns=1,
|
|
-- This is to use MultiplexedConnections
|
|
use_hedged_requests=0,
|
|
-- This is to make the initiator waiting for cancel packet in MultiplexedConnections::getReplicaForReading()
|
|
--
|
|
-- NOTE: that even smaller sleep will be enough to trigger this problem
|
|
-- with 100% probability, however just to make it more reliable, increase
|
|
-- it to 2 seconds.
|
|
sleep_in_receive_cancel_ms=2000;
|