Skip to content

wslservice stuck in stopping state & wsl --shutdown shows the error as OOM #41449

Description

Windows Version

Microsoft Windows [Version 10.0.26310.28089]

WSL Version

2.9.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

6.18.40.1-1

Other Software

Not related

Repro Steps

This is not a deterministic issue. This was found during development. Where wsl --shutdown always returns

Not enough memory resources are available to complete this operation.
Error code: Wsl/E_OUTOFMEMORY

The original trigger is not captured.

Expected Behavior

wsl shuts down normally.

Actual Behavior

The error has two folds:

  1. The service stuck in the stopping state
    The wsl VM was stopped. But the wslc VM was not. Initial analysis shows this could be a dead lock in the wslc shutdown logic.

  2. The wsl --shutdown call translates the stopping state to OOM.

    catch (...)
    {
    const auto result = wil::ResultFromCaughtException();
    // Note: S_FALSE will cause COM to retry if the service is stopping.
    return result == CO_E_SERVER_STOPPING ? S_FALSE : result;
    }

    This logic here translates the stopping state to S_FALSE. And the function is returned with S_FALSE and ppCreated = NULL. This may have caused COM to treat this as an OOM. There was system memory pressure during the repro.

Diagnostic Logs

Captured wsl log and wsl service dumps were emailed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions