CFanのBlog

A good day for snow-viewing

Tag: memory leak

  • Windows 11 runs out of committed memory: Wcmsvc leaks kernel ALPC messages on every DHCPv6 retry, and the source is an old router

    No comments on Windows 11 runs out of committed memory: Wcmsvc leaks kernel ALPC messages on every DHCPv6 retry, and the source is an old router
    86 views

    My PC had been on for a week when a local build of a front-end project failed with ‘memory allocation failed’. Task Manager showed 55 GB committed against a limit of just 56.5 GB, yet the processes added up to only about 36 GB, all of them the programs I always have open. The remaining ten-odd GB was in the kernel: the paged pool was over 10 GB, and two pool tags alone, AlMs and AlEB, accounted for 7.3 GB, with about 6.75 million allocations each, and they were still growing every second.

    It took several days and quite a few detours, but in the end a kernel pool allocation trace with call stacks found it: the memory was being leaked by the Windows Connection Manager (Wcmsvc). For every client request it handles, it sends a few ‘Sleep Study’ messages over ALPC to the Power Dependency Coordinator in the kernel, and once sent, those messages are never freed. What set it off was DHCPv6: an old router on the LAN, used as an access point, was sending router advertisements with the M flag but had no addresses to give out, so the Windows DHCPv6 client started a new request every 3–6 seconds, endlessly, leaking about 20 messages each round.

    Once I turned off IPv6 router advertisements and the DHCPv6 service on that AP, the leak stopped at once, dropping from 4–7 messages a second to about 0.1. Memory that has already leaked can only be reclaimed by rebooting. Below is a record of how I tracked it down.

    How this leak happenedThe old router sends router advertisements with the M flag but answers NoAddrsAvail; the Windows DHCPv6 client starts over every 3 seconds, and every round makes Wcmsvc send synchronous ALPC requests through umpdc.dll to the Power Dependency Coordinator in the kernel; the request messages (AlMs) and their extension buffers (AlEB) stay in the paged pool, never freed. Turning off router advertisements and DHCPv6 on the old router stops the leakHow this leak happenedThe arrows repeat every 3 seconds; the memory in the red box only ever grows.Old router (used as an AP)LEDE 17.01, no IPv6 upstreamRA has M flag: ask DHCPv6 for an addressbut DHCPv6 replies NoAddrsAvail (none)Windows DHCPv6 clientDrops Advertise with no address (correct)but no backoff: starts over every 3 sEvery round calls WcmsvcuserRAAdvertiseClient request begin/endWcmsvc (Conn. Manager)SleepStudy::IndicateClientRequest…Adds / removes a Sleep Study blocker ref.Sends sync ALPC requests via umpdc.dlluserPower Dep. Coord. (pdc.sys)Receives requests, replies normallybut nobody frees the request messagekernelALPCreply!Leak: piling up in the paged poolEach request leaves 1 ALPC message (AlMs) and 1 extension buffer (AlEB), about 1.1 KB in all.About 20 a round, 4–7 a second, ~0.5 GB a day. Restarting Wcmsvc won’t free them; only rebooting will.Fix: turn off RA, DHCPv6 and the NDP proxy on the old router’s LANWithout the M flag, DHCPv6 stops retrying; the leak falls from 4–7 a second to about 0.1.
    The whole chain: the old router keeps DHCPv6 retrying non-stop, and every round makes Wcmsvc leak about 20 kernel messages.
    Continue reading: Windows 11 runs out of committed memory: Wcmsvc leaks kernel ALPC messages on every DHCPv6 retry, and the source is an old router18 min left
    Read more: Windows 11 runs out of committed memory: Wcmsvc leaks kernel ALPC messages on every DHCPv6 retry, and the source is an old router