Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a kill has already been delivered, make the Kill() function a no-op, and simply return previous status. The documentation of TerminateProcess states that a process cannot prevent itself from being terminated. That means that once we successfully deliver a kill signal, there is no real justification to send a second one.
Additionally, we also ignore two errors that are potentially returned by
HcsTerminateProcess
.A bit of background on this. We've noticed during testing, that sending multiple Kill() signals to a process will sometimes return one of two (maybe more?) errors:
In both cases, an error is returned signaling that the desired state reflects the current state of the process. These two errors should be ignored by Kill(), as there is no real reason to bubble them up the stack and have these errors handled by the called of Kill().
We want to both ignore a second call to Kill() and ignore these two errors, as processes started by containers bay be killed by external actors (human operator, an automated process, OOM, etc).