mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix possible Logical error: Cannot write to finalized buffer
This commit is contained in:
parent
2da5c6b71b
commit
7c84d95908
@ -129,6 +129,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFinalized() const { return finalized; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void finalizeImpl()
|
virtual void finalizeImpl()
|
||||||
{
|
{
|
||||||
|
@ -929,6 +929,15 @@ void HTTPHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse
|
|||||||
request_credentials.reset(); // ...so that the next requests on the connection have to always start afresh in case of exceptions.
|
request_credentials.reset(); // ...so that the next requests on the connection have to always start afresh in case of exceptions.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Check if exception was thrown in used_output.finalize().
|
||||||
|
/// In this case used_output can be in invalid state and we
|
||||||
|
/// cannot write in it anymore. So, just log this exception.
|
||||||
|
if (used_output.isFinalized())
|
||||||
|
{
|
||||||
|
tryLogCurrentException(log, "Cannot flush data to client");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tryLogCurrentException(log);
|
tryLogCurrentException(log);
|
||||||
|
|
||||||
/** If exception is received from remote server, then stack trace is embedded in message.
|
/** If exception is received from remote server, then stack trace is embedded in message.
|
||||||
@ -939,6 +948,7 @@ void HTTPHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse
|
|||||||
|
|
||||||
trySendExceptionToClient(exception_message, exception_code, request, response, used_output);
|
trySendExceptionToClient(exception_message, exception_code, request, response, used_output);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
used_output.finalize();
|
used_output.finalize();
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,11 @@ private:
|
|||||||
if (out)
|
if (out)
|
||||||
out->finalize();
|
out->finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool isFinalized() const
|
||||||
|
{
|
||||||
|
return out_maybe_delayed_and_compressed->isFinalized();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IServer & server;
|
IServer & server;
|
||||||
|
Loading…
Reference in New Issue
Block a user