Merge pull request #20547 from azat/fix-sigsegv-on-unknown-packet

Fix SIGSEGV on Unknown packet for Distributed queries
This commit is contained in:
Nikolai Kochetov 2021-02-16 13:12:24 +03:00 committed by GitHub
commit c933fefa99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -756,7 +756,11 @@ std::optional<UInt64> Connection::checkPacket(size_t timeout_microseconds)
Packet Connection::receivePacket(std::function<void(Poco::Net::Socket &)> async_callback)
{
in->setAsyncCallback(std::move(async_callback));
SCOPE_EXIT(in->setAsyncCallback({}));
SCOPE_EXIT({
/// disconnect() will reset "in".
if (in)
in->setAsyncCallback({});
});
try
{