[WSLg / audio] Windows Audio service (Audiosrv) leaks ETW registrations while Linux apps play sound; kernel pools reach tens of GB

Open
#42,284 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, linux, powershell, python, ubuntu

Research direction

Read the full write-up in the first comment and the attachments before touching anything: the WPR pool trace summary ties 99.97% of the EtwD/Etwr allocations to the svchost hosting Audiosrv. Reproduce with the paplay loop against the RDPSink PulseAudio sink while sampling tags with the attached etwtags.ps1 or poolmon, then compare against a WSLg audio path where streams are opened and closed once. Done means those ETW registrations are released when a stream closes and pool growth stays flat under the loop.

Written by the indexing model from the issue text.

Description

Windows Version

Windows 11 25H2, build 26200.9711

WSL Version

WSL 3.0.5.0, kernel 6.18.58.1-1, WSLg 1.0.79

Are you using WSL 1, WSL 2, or WSLC?
  • WSL 2
  • WSL 1
  • WSLC
Kernel Version

6.18.58.1-1

Distro Version

Ubuntu 24.04

Other Software
  • Windows 11 25H2 (10.0.26200.9711)

  • WSL 3.0.5.0, kernel 6.18.58.1-1, WSLg 1.0.79, MSRDC 1.2.7391

  • Ubuntu 24.04, PulseAudio from WSLg, default sink RDPSink

  • .wslconfig: memory=20GB, swap=8GB, networkingMode=mirrored, autoMemoryReclaim=gradual

Repro Steps
  1. In a WSL2 distribution with WSLg (default PulseAudio sink "RDPSink"),
    create a short silent clip and open/close audio streams in a loop:

    python3 -c "import wave; w=wave.open('/tmp/s.wav','wb'); w.setnchannels(2); w.setsampwidth(2); w.setframerate(48000); w.writeframes(bytes(9600)); w.close()"
    while :; do paplay /tmp/s.wav; done

  2. On Windows, watch the kernel pool tags EtwD (paged) and Etwr (nonpaged),
    e.g. with the attached etwtags.ps1 (20 s delta, no elevation needed):

    powershell -ExecutionPolicy Bypass -File .\etwtags.ps1 20

    or with poolmon from the WDK (tags EtwD, Etwr).

  3. The same happens with any Linux app that plays sound for a long time;
    we first saw it with a game (Diablo IV through Wine/Proton): over a few
    hours the pools grew to tens of GB and WSL stopped responding.

A pool-allocation trace (wpr -start Pool) attributes 99.97% of the EtwD/Etwr
allocations to the svchost.exe that hosts only Audiosrv (Windows Audio);
summary attached.

Expected Behavior

Opening, playing and closing audio streams from WSLg does not grow kernel
pool usage; ETW registrations made for a stream are freed when it closes.

Actual Behavior

EtwD and Etwr grow one-to-one (each pair looks like one ETW registration),
allocated by Audiosrv:

  • About 2,000 registrations per audio stream opened and closed
    (+25,207 in 20 s for 13 paplay runs; preliminary, measured while earlier
    leaked registrations were still being freed).
  • While a stream is active, the slow freeing of earlier registrations stops.
  • With a game playing sound: 680 to over 6,000 per second, after the first
    minutes of a session.
  • After the Linux app exits they are freed at only ~3,000-4,400 per second.
    Result on a 31 GB machine: paged pool 60 GB (EtwD 52.7 GB, 115 M
    allocations), nonpaged 11 GB (Etwr 8.7 GB), commit 110.9 of 112.1 GB; WSL
    stopped responding and needed wsl --shutdown. Both pools were below 1.1 GB
    after a reboot.
Diagnostic Logs

03-attachments.zip

Attachments: WPR pool trace summary, pool tag snapshots, measurement scripts. Full write-up in the first comment. The 12 GB ETL is available on request.

Dominant language
C++
Stars
34.4k
Forks
1.9k
Avg merge
1d 23h
Merged PRs (30d)
166

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/WSL

All issues in microsoft/WSL

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.