Skip to content

Windows: If HcsShutdownComputeSystem returns ERROR_PROC_NOT_FOUND, moby leaks the container #42610

Description

@kevpar

HCS provides two functions to stop a container:

  • HcsShutdownComputeSystem is used first, and attempts to gracefully stop the container.
  • HcsTerminateComputeSystem is used if shutdown fails, and force stops the container.

moby uses hcsshim.IsAlreadyStopped to check if the error returned from HcsShutdownComputeSystem indicates that the container has already terminated, and only calls HcsTerminateComputeSystem if it is still running. However, due to a bug in hcsshim.IsAlreadyStopped, this function returned true if the error was ERROR_PROC_NOT_FOUND, which can be returned even if the container is left running. When this happened, moby would effectively leak the container, leaving it running in HCS, but assuming from moby's point of view that it had stopped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions