Skip to content

[moby backport] Remove ERROR_PROC_NOT_FOUND from error checks#1066

Merged
kevpar merged 1 commit intomicrosoft:mobyfrom
thaJeztah:moby_backport_no_ERROR_PROC_NOT_FOUND
Jul 9, 2021
Merged

[moby backport] Remove ERROR_PROC_NOT_FOUND from error checks#1066
kevpar merged 1 commit intomicrosoft:mobyfrom
thaJeztah:moby_backport_no_ERROR_PROC_NOT_FOUND

Conversation

@thaJeztah
Copy link
Copy Markdown
Contributor

Same as #1065; backport of #1064 for the "moby" branch, which is currently used for the Docker 20.10 releases.

Relates to moby/moby#42611

Previously, certain error check functions like IsAlreadyStopped returned
true if the error was ERROR_PROC_NOT_FOUND. Based on the comment in the
file, this was intended to be used to indicate a case where the process
could not be found. However, it seems this may have been added
erroneously. ERROR_PROC_NOT_FOUND is actually typically used to mean
that a procedure lookup failed, and has nothing to do with processes.

The original change[1] to check against ERROR_PROC_NOT_FOUND was made
five years ago, and did not contain much information on why this error
would be returned. We are removing this now based on several factors:

  • We are not aware of any condition where HCS would intentionally return
    ERROR_PROC_NOT_FOUND to indicate a condition "process does not exist".
  • There is an issue where HcsShutdownComputeSystem sometimes returns
    ERROR_PROC_NOT_FOUND due to something failing internally. The current
    error checks are causing this to be treated as "the container has
    already exited", causing moby to not properly stop the container via
    HcsTerminateComputeSystem.

This change leaves the definition for ErrProcNotFound in the code, as it
may be used by external callers, but fixes its comment.

[1]: See commit 0ae7e7e

Signed-off-by: Kevin Parsons kevpar@microsoft.com
(cherry picked from commit d78544d)
Signed-off-by: Sebastiaan van Stijn github@gone.nl

Previously, certain error check functions like IsAlreadyStopped returned
true if the error was ERROR_PROC_NOT_FOUND. Based on the comment in the
file, this was intended to be used to indicate a case where the process
could not be found. However, it seems this may have been added
erroneously. ERROR_PROC_NOT_FOUND is actually typically used to mean
that a _procedure_ lookup failed, and has nothing to do with processes.

The original change[1] to check against ERROR_PROC_NOT_FOUND was made
five years ago, and did not contain much information on why this error
would be returned. We are removing this now based on several factors:

- We are not aware of any condition where HCS would intentionally return
  ERROR_PROC_NOT_FOUND to indicate a condition "process does not exist".
- There is an issue where HcsShutdownComputeSystem sometimes returns
  ERROR_PROC_NOT_FOUND due to something failing internally. The current
  error checks are causing this to be treated as "the container has
  already exited", causing moby to not properly stop the container via
  HcsTerminateComputeSystem.

This change leaves the definition for ErrProcNotFound in the code, as it
may be used by external callers, but fixes its comment.

[1]: See commit 0ae7e7e

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
(cherry picked from commit d78544d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah requested a review from a team as a code owner July 9, 2021 15:42
@thaJeztah
Copy link
Copy Markdown
Contributor Author

/cc @kevpar ptal

Copy link
Copy Markdown
Member

@kevpar kevpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevpar kevpar merged commit 64a2b71 into microsoft:moby Jul 9, 2021
@thaJeztah thaJeztah deleted the moby_backport_no_ERROR_PROC_NOT_FOUND branch July 9, 2021 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants