mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Allow vfork
This commit is contained in:
parent
fb5b1c3d6a
commit
d6ece47b7f
@ -155,12 +155,17 @@ std::unique_ptr<ShellCommand> ShellCommand::executeImpl(
|
|||||||
{
|
{
|
||||||
logCommand(filename, argv);
|
logCommand(filename, argv);
|
||||||
|
|
||||||
|
#if !defined(USE_MUSL)
|
||||||
/** Here it is written that with a normal call `vfork`, there is a chance of deadlock in multithreaded programs,
|
/** Here it is written that with a normal call `vfork`, there is a chance of deadlock in multithreaded programs,
|
||||||
* because of the resolving of symbols in the shared library
|
* because of the resolving of symbols in the shared library
|
||||||
* http://www.oracle.com/technetwork/server-storage/solaris10/subprocess-136439.html
|
* http://www.oracle.com/technetwork/server-storage/solaris10/subprocess-136439.html
|
||||||
* Therefore, separate the resolving of the symbol from the call.
|
* Therefore, separate the resolving of the symbol from the call.
|
||||||
*/
|
*/
|
||||||
static void * real_vfork = dlsym(RTLD_DEFAULT, "vfork");
|
static void * real_vfork = dlsym(RTLD_DEFAULT, "vfork");
|
||||||
|
#else
|
||||||
|
/// If we use Musl with static linking, there is no dlsym and no issue with vfork.
|
||||||
|
static void * real_vfork = reinterpret_cast<void *>(&vfork);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!real_vfork)
|
if (!real_vfork)
|
||||||
throwFromErrno("Cannot find symbol vfork in myself", ErrorCodes::CANNOT_DLSYM);
|
throwFromErrno("Cannot find symbol vfork in myself", ErrorCodes::CANNOT_DLSYM);
|
||||||
|
Loading…
Reference in New Issue
Block a user