-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-33031 Add the option to terminate a child process gracefully #19317
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1690,7 +1690,7 @@ class CWindowsPipeProcess: implements IPipeProcess, public CInterface | |
doCloseError(); | ||
} | ||
|
||
void abort() | ||
void abort(bool gracefull) override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trivial: and add 'virtual' ? |
||
{ | ||
CriticalBlock block(sect); | ||
if (pipeProcess != (HANDLE)-1) { | ||
|
@@ -2416,7 +2416,7 @@ protected: friend class PipeWriterThread; | |
} | ||
} | ||
|
||
void abort() | ||
void abort(bool graceful) override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trivial: and add 'virtual' ? |
||
{ | ||
CriticalBlock block(sect); | ||
aborted = true; | ||
|
@@ -2432,10 +2432,11 @@ protected: friend class PipeWriterThread; | |
if (pipeProcess != (HANDLE)-1) { | ||
if (title.length()) | ||
PROGLOG("%s: Forcibly killing pipe process %d",title.get(),pipeProcess); | ||
int signalToSend = graceful ? SIGTERM : SIGKILL; | ||
if (newProcessGroup) | ||
::kill(-pipeProcess,SIGKILL); | ||
::kill(-pipeProcess,signalToSend); | ||
else | ||
::kill(pipeProcess,SIGKILL); // if this doesn't kill it we are in trouble | ||
::kill(pipeProcess,signalToSend); // if this doesn't kill it we are in trouble | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if graceful, should there be a grace period, which if exceeded fires a SIGKILL anyway..? |
||
CriticalUnblock unblock(sect); | ||
wait(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this/almost all should be graceful too really, but to avoid potential deadlock from misbehaving child, it would be good if abort fired a SIGKILL after a given period of grace time..