mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Fix segfault in TSan on _exit
This commit is contained in:
parent
69118cb4ca
commit
cdef8f33d8
@ -14,6 +14,7 @@
|
|||||||
#include <Poco/Net/NetException.h>
|
#include <Poco/Net/NetException.h>
|
||||||
#include <Poco/Util/HelpFormatter.h>
|
#include <Poco/Util/HelpFormatter.h>
|
||||||
#include <ext/scope_guard.h>
|
#include <ext/scope_guard.h>
|
||||||
|
#include <common/defines.h>
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
#include <common/phdr_cache.h>
|
#include <common/phdr_cache.h>
|
||||||
#include <common/ErrorHandlers.h>
|
#include <common/ErrorHandlers.h>
|
||||||
@ -86,6 +87,8 @@
|
|||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
# include <sys/ptrace.h>
|
# include <sys/ptrace.h>
|
||||||
# include <Common/hasLinuxCapability.h>
|
# include <Common/hasLinuxCapability.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sys/syscall.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_SSL
|
#if USE_SSL
|
||||||
@ -426,6 +429,19 @@ void checkForUsersNotInMainConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[[noreturn]] void forceShutdown()
|
||||||
|
{
|
||||||
|
#if defined(THREAD_SANITIZER) && defined(OS_LINUX)
|
||||||
|
/// Thread sanitizer tries to do something on exit that we don't need if we want to exit immediately,
|
||||||
|
/// while connection handling threads are still run.
|
||||||
|
(void)syscall(SYS_exit_group, 0);
|
||||||
|
__builtin_unreachable();
|
||||||
|
#else
|
||||||
|
_exit(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Server::main(const std::vector<std::string> & /*args*/)
|
int Server::main(const std::vector<std::string> & /*args*/)
|
||||||
{
|
{
|
||||||
Poco::Logger * log = &logger();
|
Poco::Logger * log = &logger();
|
||||||
@ -1435,7 +1451,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
|||||||
/// Dump coverage here, because std::atexit callback would not be called.
|
/// Dump coverage here, because std::atexit callback would not be called.
|
||||||
dumpCoverageReportIfPossible();
|
dumpCoverageReportIfPossible();
|
||||||
LOG_INFO(log, "Will shutdown forcefully.");
|
LOG_INFO(log, "Will shutdown forcefully.");
|
||||||
_exit(Application::EXIT_OK);
|
forceShutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user