Skip to content

Running wsl.exe causes "Application Info"/appinfo service to leak ~5 registry handles. Turns into a very steady leak with Docker Desktop. Hundreds of thousands of handles leaked after a week uptime. #9851

Closed

Description

Windows Version

Microsoft Windows [Version 10.0.22621.1413]

WSL Version

WSL version: 1.1.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.90.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Fri Jan 27 02:56:13 UTC 2023

Distro Version

Ubuntu Release: 22.04

Other Software

Docker Desktop 4.17.1 (101757) is currently the newest version available.

Repro Steps

On a fresh clean install of Windows.

  • Install WSL2 and Ubuntu
  • Install Docker Desktop with WSL2 Integration
  • Install Process Explorer
  • Install Process Monitor

After those services are installed and all is running:

  • Using Process Explorer, locate the svchost.exe that is hosting the "Application Info" service.
  • Observe that it's handles are climbing up steadily while Docker Desktop is running.
  • Close Docker Desktop
  • Watch the handles stop climbing on the svchost.exe
  • Run wsl.exe from Powershell. Then exit. Observe that the handles increase a slight bit by 10, then drops down to a 4-5 overall increase. It never goes back down.

Expected Behavior

The "Application Info" service should return to the same number of handles after an invocation and exit of wsl.exe. This includes periodic calls to wsl.exe from applications such as "Docker Desktop".

Actual Behavior

Handle leak in svchost.exe of "Application Info" service.
Something that happens when wsl.exe is called is causing this "Application Info" svchost.exe to open some registry keys to "HKLM\SOFTWARE" and not close all the handles it opens. I'm not aware if other executables or operations that can cause this.

Process Monitor on a quiet system after running wsl.exe and exiting:

image

Process Explorer:

Imagine Process explorer having 100,000 of these handles and trying to display them. It can! The scroll bar gets real tiny though.

image

When combined with periodic calls to wsl.exe from applications such as "Docker Desktop", this can result in hundreds of thousands of leaked handles in this svchost.exe. On my installs, I've seen it go up to about 800,000 handles to "HKLM\SOFTWARE" after about a week of uptime with Docker Desktop running before my computer gets really sluggish. In exchange for about 5 - 10 minutes of downtime in Windows, I can kill the "svchost.exe" as a workaround, and wait for it to come back up sans the handles leaked.

Diagnostic Logs

WslLogs-2023-03-26_21-52-05.zip

Activity

  1. changed the title [-]Running `wsl.exe` causes "Application Info"/`appinfo` service to leak ~5 registry handles. Turns into a very steady leak with Docker Desktop.[/-] [+]Running `wsl.exe` causes "Application Info"/`appinfo` service to leak ~5 registry handles. Turns into a very steady leak with Docker Desktop. Hundreds of thousands of handles leaked after a week.[/+] on Mar 27, 2023
  2. changed the title [-]Running `wsl.exe` causes "Application Info"/`appinfo` service to leak ~5 registry handles. Turns into a very steady leak with Docker Desktop. Hundreds of thousands of handles leaked after a week.[/-] [+]Running `wsl.exe` causes "Application Info"/`appinfo` service to leak ~5 registry handles. Turns into a very steady leak with Docker Desktop. Hundreds of thousands of handles leaked after a week uptime.[/+] on Mar 27, 2023
  3. nelsonjchen commented on Mar 29, 2023

    @nelsonjchen
    Author

    OK, I'll run that. I've since reinstalled more stuff since then on my system though. If desired, I can try to reproduce it clean again in a Hyper-V VM with nested virtualization.

    Image Name                     PID Services
    ========================= ======== ============================================
    svchost.exe                   1268 BrokerInfrastructure, DcomLaunch, PlugPlay,
                                       Power, SystemEventsBroker
    svchost.exe                   1440 RpcEptMapper, RpcSs
    svchost.exe                   1496 LSM
    svchost.exe                   1640 HvHost
    svchost.exe                   1656 CryptSvc
    svchost.exe                   1672 lmhosts
    svchost.exe                   1688 BTAGService
    svchost.exe                   1716 BthAvctpSvc
    svchost.exe                   1740 bthserv
    svchost.exe                   1924 nsi
    svchost.exe                   1944 ProfSvc
    svchost.exe                   1952 NcbService
    svchost.exe                   1960 TimeBrokerSvc
    svchost.exe                   1968 PhoneSvc
    svchost.exe                   2012 netprofm
    svchost.exe                   1220 AppIDSvc
    svchost.exe                   2064 UserManager
    svchost.exe                   2092 hidserv
    svchost.exe                   2384 Dnscache
    svchost.exe                   2488 DeviceAssociationService
    svchost.exe                   2512 Dhcp
    svchost.exe                   2668 WinHttpAutoProxySvc
    svchost.exe                   2752 hns
    svchost.exe                   2868 camsvc
    svchost.exe                   2876 Winmgmt
    svchost.exe                   2928 Schedule
    svchost.exe                   3004 EventSystem
    svchost.exe                   3080 StateRepository
    svchost.exe                   3360 CoreMessagingRegistrar
    svchost.exe                   3664 DispBrokerDesktopSvc
    svchost.exe                   3584 BFE, mpssvc
    svchost.exe                   4068 EventLog
    svchost.exe                   1888 SysMain
    svchost.exe                   3204 SENS
    svchost.exe                   3260 Themes
    svchost.exe                   3560 AudioEndpointBuilder
    svchost.exe                   3492 FontCache
    svchost.exe                   4256 Audiosrv
    svchost.exe                   4284 TextInputManagementService
    svchost.exe                   4428 DusmSvc
    svchost.exe                   4436 Wcmsvc
    svchost.exe                   4628 WlanSvc
    svchost.exe                   4652 ShellHWDetection
    svchost.exe                   4928 LanmanWorkstation
    svchost.exe                   5000 DiagTrack
    svchost.exe                   5008 iphlpsvc
    svchost.exe                   5016 DPS
    svchost.exe                   5024 WpnService
    svchost.exe                   5032 TrkWks
    svchost.exe                   5288 WdiServiceHost
    svchost.exe                   5320 nvagent
    svchost.exe                   5520 SharedAccess
    svchost.exe                   5728 LanmanServer
    svchost.exe                   6508 NgcSvc
    svchost.exe                   1052 PcaSvc
    svchost.exe                   2028 RmSvc
    svchost.exe                   6248 DoSvc
    svchost.exe                   6928 NgcCtnrSvc
    svchost.exe                   8000 StorSvc
    svchost.exe                   3524 SSDPSRV
    svchost.exe                   1708 CDPSvc
    svchost.exe                   1768 UsoSvc
    svchost.exe                   3380 wscsvc
    svchost.exe                   3500 DsSvc
    svchost.exe                   7776 webthreatdefsvc
    svchost.exe                   5908 CDPUserSvc_114d9d6
    svchost.exe                   3384 webthreatdefusersvc_114d9d6
    svchost.exe                   3016 WpnUserService_114d9d6
    svchost.exe                   2564 TokenBroker
    svchost.exe                   4464 WdiSystemHost
    svchost.exe                   8784 cbdhsvc_114d9d6
    svchost.exe                   3452 Appinfo
    svchost.exe                   9788 UdkUserSvc_114d9d6
    svchost.exe                  13268 OneSyncSvc_114d9d6,
                                       PimIndexMaintenanceSvc_114d9d6,
                                       UnistoreSvc_114d9d6, UserDataSvc_114d9d6
    svchost.exe                  13252 lfsvc
    svchost.exe                  19848 QWAVE
    svchost.exe                  14620 NPSMSvc_114d9d6
    svchost.exe                   5836 SstpSvc
    svchost.exe                   7452 RasMan
    svchost.exe                  23876 LicenseManager
    svchost.exe                  25320 InstallService
    svchost.exe                  22760 CaptureService_114d9d6
    svchost.exe                  14016 BITS
    svchost.exe                  28896 DisplayEnhancementService
    svchost.exe                  23816 SensorService
    svchost.exe                  32164 W32Time
    svchost.exe                   7956 wuauserv
    svchost.exe                  18808 AppXSvc
    

    "Appinfo" looks like this in process explorer right now, 200k after a few days:

    image

    @pmartincic That said, I don't know what you mean by "us". "us" like the WSL team or Microsoft? "Appinfo" is a Windows service. It's not third-party software. I'm guessing AppInfo is not a WSL team service though.

    image

    I do have some thoughts on how this might be resolved but I'm just naive.

    • Let the leak continue to happen but reach out to the Docker Desktop people and help them architecture their software to not constantly periodic open/close wsl.exe or equivalent. In other words, maybe they could make it like VSCode's WSL support where a channel is opened but wsl.exe isn't being started and stopped often and keep the calls low. I suspect this might also be present in Docker Desktop alternatives like Rancher Desktop or Podman Desktop as well if those UIs/setups may also periodically be calling wsl.exe.
    • Coordinate with the team responsible for the Appinfo service and see how the wsl.exe process might be causing it to leak the handles. Maybe fix the wsl.exe process to not cause Appinfo to leak or fix the leak in Appinfo that happens when wsl.exe is called.
  4. microsoft-github-policy-service commented on Mar 28, 2024

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions