From 7474a7e3ca139f1a4e88e83af011b304ebdcaf3c Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Fri, 19 Feb 2021 22:42:40 +0300 Subject: [PATCH] Increase buffer for uncaught exception / std::terminate Use PIPE_BUF over some magic number 1024 in terminate_handler, since according to pipe(7): PIPE_BUF POSIX.1 says that write(2)s of less than PIPE_BUF bytes must be atomic Also note that 1024, is too small, especially for C++ stacktraces (and especially for debug builds, that contains lots of non-inlined helpers for various ptrs). --- base/daemon/BaseDaemon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/daemon/BaseDaemon.cpp b/base/daemon/BaseDaemon.cpp index db7019d357..248ffdd4d1 100644 --- a/base/daemon/BaseDaemon.cpp +++ b/base/daemon/BaseDaemon.cpp @@ -416,7 +416,7 @@ static void sanitizerDeathCallback() else log_message = "Terminate called without an active exception"; - static const size_t buf_size = 1024; + static const size_t buf_size = PIPE_BUF; if (log_message.size() > buf_size - 16) log_message.resize(buf_size - 16); -- GitLab