mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #20464 from azat/abnormal-server-termination-fix
Fix abnormal server termination when http client goes away
This commit is contained in:
commit
9557bca4af
@ -188,14 +188,14 @@ void WriteBufferFromHTTPServerResponse::onProgress(const Progress & progress)
|
||||
|
||||
void WriteBufferFromHTTPServerResponse::finalize()
|
||||
{
|
||||
if (offset())
|
||||
next();
|
||||
if (out)
|
||||
{
|
||||
next();
|
||||
|
||||
if (out)
|
||||
out.reset();
|
||||
out->next();
|
||||
out.reset();
|
||||
}
|
||||
else
|
||||
|
||||
if (!offset())
|
||||
{
|
||||
/// If no remaining data, just send headers.
|
||||
std::lock_guard lock(mutex);
|
||||
|
@ -715,7 +715,6 @@ void HTTPHandler::trySendExceptionToClient(const std::string & s, int exception_
|
||||
writeChar('\n', *used_output.out_maybe_compressed);
|
||||
|
||||
used_output.out_maybe_compressed->next();
|
||||
used_output.out->next();
|
||||
used_output.out->finalize();
|
||||
}
|
||||
}
|
||||
@ -775,6 +774,9 @@ void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne
|
||||
|
||||
trySendExceptionToClient(exception_message, exception_code, request, response, used_output);
|
||||
}
|
||||
|
||||
if (used_output.out)
|
||||
used_output.out->finalize();
|
||||
}
|
||||
|
||||
DynamicQueryHandler::DynamicQueryHandler(IServer & server_, const std::string & param_name_)
|
||||
|
Loading…
Reference in New Issue
Block a user