mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Ensure to kill and reap plugin process
`llvm::sys::Wait(process, /*SecondsToWait=*/0)` perform a non-blocking `wait`. That means the plugin goes a zombie if it hasn't exited. Set `SecondsToWait` 1 so it wait for 1 second and kill it on the time out. Usually, when the pipe is closed, the plugins detect the EOF in stdin and exits immediately, fo the parent process usually don't wait for the timeout. rdar://148110944
This commit is contained in:
@@ -214,7 +214,13 @@ LoadedExecutablePlugin::PluginProcess::~PluginProcess() {
|
||||
close(input);
|
||||
close(output);
|
||||
#endif
|
||||
llvm::sys::Wait(process, /*SecondsToWait=*/0);
|
||||
|
||||
// Set `SecondsToWait` non-zero so it waits for the timeout and kill it after
|
||||
// that. Usually when the pipe is closed above, the plugin detects the EOF in
|
||||
// the stdin and exits immediately, so this usually doesn't wait for the
|
||||
// timeout. Note that we can't use '0' because it performs a non-blocking
|
||||
// wait, which make the plugin a zombie if it hasn't exited.
|
||||
llvm::sys::Wait(process, /*SecondsToWait=*/1);
|
||||
}
|
||||
|
||||
ssize_t LoadedExecutablePlugin::PluginProcess::read(void *buf,
|
||||
|
||||
Reference in New Issue
Block a user