Ignore memory limits while logging

Otherwise there can be pretty noisy messages, like here [1]:

    Cannot add message to the log: Code: 241. DB::Exception: Memory limit (for user) exceeded: would use 42.02 MiB (attempt to allocate chunk of 2101278 bytes), maximum: 4.77 MiB. OvercommitTracker decision: Waiting timeout for memory to be freed is reached. (MEMORY_LIMIT_EXCEEDED), Stack trace (when copying this message, always include the lines below):

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/0/efc74e33e580b7d3ff33c3e269db86addfaa6b51/stateless_tests__msan__[2/3].html

And it should be okay to ignore server limits too, since it always
better to have a proper log message in a proper place, not stderr which
does not inspected usually.

Follow-up for: #24069
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-09-04 22:10:53 +02:00
parent 025c7a1ae0
commit 313747688e

View File

@ -46,6 +46,8 @@ void OwnSplitChannel::log(const Poco::Message & msg)
void OwnSplitChannel::tryLogSplit(const Poco::Message & msg)
{
LockMemoryExceptionInThread lock_memory_tracker(VariableContext::Global);
try
{
logSplit(msg);
@ -62,8 +64,6 @@ void OwnSplitChannel::tryLogSplit(const Poco::Message & msg)
/// but let's log it into the stderr at least.
catch (...)
{
LockMemoryExceptionInThread lock_memory_tracker(VariableContext::Global);
const std::string & exception_message = getCurrentExceptionMessage(true);
const std::string & message = msg.getText();