mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
add test logs on connection close
This commit is contained in:
parent
8010479394
commit
e59f217f8d
@ -190,7 +190,10 @@ void TCPHandler::runImpl()
|
||||
|
||||
/// If we need to shut down, or client disconnects.
|
||||
if (!tcp_server.isOpen() || server.isCancelled() || in->eof())
|
||||
{
|
||||
LOG_TEST(log, "Closing connection (open: {}, cancelled: {}, eof: {})", tcp_server.isOpen(), server.isCancelled(), in->eof());
|
||||
break;
|
||||
}
|
||||
|
||||
Stopwatch watch;
|
||||
state.reset();
|
||||
@ -406,6 +409,8 @@ void TCPHandler::runImpl()
|
||||
if (e.code() == ErrorCodes::UNKNOWN_PACKET_FROM_CLIENT)
|
||||
throw;
|
||||
|
||||
LOG_TEST(log, "Going to close connection due to exception: {}", e.message());
|
||||
|
||||
/// If there is UNEXPECTED_PACKET_FROM_CLIENT emulate network_error
|
||||
/// to break the loop, but do not throw to send the exception to
|
||||
/// the client.
|
||||
@ -435,7 +440,7 @@ void TCPHandler::runImpl()
|
||||
// Server should die on std logic errors in debug, like with assert()
|
||||
// or ErrorCodes::LOGICAL_ERROR. This helps catch these errors in
|
||||
// tests.
|
||||
#ifndef NDEBUG
|
||||
#ifdef ABORT_ON_LOGICAL_ERROR
|
||||
catch (const std::logic_error & e)
|
||||
{
|
||||
state.io.onException();
|
||||
@ -554,14 +559,14 @@ bool TCPHandler::readDataNext()
|
||||
Stopwatch watch(CLOCK_MONOTONIC_COARSE);
|
||||
|
||||
/// Poll interval should not be greater than receive_timeout
|
||||
constexpr UInt64 min_timeout_ms = 5000; // 5 ms
|
||||
UInt64 timeout_ms = std::max(min_timeout_ms, std::min(poll_interval * 1000000, static_cast<UInt64>(receive_timeout.totalMicroseconds())));
|
||||
constexpr UInt64 min_timeout_us = 5000; // 5 ms
|
||||
UInt64 timeout_us = std::max(min_timeout_us, std::min(poll_interval * 1000000, static_cast<UInt64>(receive_timeout.totalMicroseconds())));
|
||||
bool read_ok = false;
|
||||
|
||||
/// We are waiting for a packet from the client. Thus, every `POLL_INTERVAL` seconds check whether we need to shut down.
|
||||
while (true)
|
||||
{
|
||||
if (static_cast<ReadBufferFromPocoSocket &>(*in).poll(timeout_ms))
|
||||
if (static_cast<ReadBufferFromPocoSocket &>(*in).poll(timeout_us))
|
||||
{
|
||||
/// If client disconnected.
|
||||
if (in->eof())
|
||||
|
Loading…
Reference in New Issue
Block a user