Handle exception in finalize inside WriteBufferFromPocoSocket destructor

This commit is contained in:
Kruglov Pavel 2023-05-11 14:16:48 +02:00 committed by GitHub
parent 57b8e74cea
commit 20007504a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,7 +106,22 @@ WriteBufferFromPocoSocket::WriteBufferFromPocoSocket(Poco::Net::Socket & socket_
WriteBufferFromPocoSocket::~WriteBufferFromPocoSocket()
{
finalize();
#ifndef NDEBUG
if (!finalized)
{
LOG_ERROR(log, "WriteBufferFromPocoSocket is not finalized in destructor. It's a bug");
std::terminate();
}
#else
try
{
finalize();
}
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
}
#endif
}
}