Skip to content

Command hangs when autoMemoryReclaim=gradual with distro systemd enabled #10675

Open
@AzureZeng

Description

@AzureZeng

Windows Version

Microsoft Windows [Version 10.0.22621.2428]

WSL Version

2.0.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Debian 12 + Arch Linux

Other Software

Visual Studio Code (Latest version) with C# extension
.NET Core SDK 6.0/7.0
Docker Desktop 4.24.2 (124339)

Repro Steps

  1. Update to latest WSL pre-release version by running wsl --update --pre-release
  2. Enable systemd support in wsl.conf
  3. Set autoMemoryReclaim=gradual in .wslconfig
  4. Restart WSL to apply settings
  5. Do something such as updating packages or writing apps in WSL, or open Docker Desktop, then WSL will allocate a lot of buff/cache memory
  6. After that, place WSL distro command line windows aside for several minutes, to avoid WSL terminating distro automatically, and to allow WSL reclaiming memory
  7. Then, execute arbitrary of commands, such as sudo pacman -Syu sudo apt update systemctl status.

Expected Behavior

This command will be executed instantly.

Actual Behavior

You will find that this command may hangs for a very long time. After kernel re-allocating buff/cache memory, everything works again.

Disabling systemd support also works.

I think it is maybe a mechanism in Linux kernel.

Screenshots:

image

image

Diagnostic Logs

WslLogs-2023-10-25_16-30-50.zip

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