Home
%3CLINGO-SUB%20id%3D%22lingo-sub-571035%22%20slang%3D%22en-US%22%3ELet%20me%20Count%20the%20Ways%3A%20Determining%20Why%20the%20System%20Process%20Consumes%20100%25%20of%20a%20Single%20CPU%20Core%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-571035%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EFirst%20published%20on%20TECHNET%20on%20Mar%2026%2C%202019%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%20%3CEM%3E%20NOTE%3A%20This%20blog%20is%20going%20through%20a%20specific%20issue%20in%20order%20to%20help%20show%20the%20steps%20involved%20in%20troubleshooting%20this%20type%20of%20issue.%20The%20process%20name(s)%20referenced%20in%20this%20content%2C%20except%20for%20System%2C%20can%20be%20any%20process%2C%20and%20not%20just%20the%20process%20used%20as%20an%20example%20in%20this%20post%2C%20and%20in%20no%20way%20are%20there%20expectations%2C%20no%20is%20it%20implied%2C%20that%20this%20particular%20process%20will%20cause%20you%20any%20problems!%20%3CBR%20%2F%3E%3C%2FEM%3E%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHey%20everyone%2C%20Konstantin%20Chernyi%20here.%20I'm%20a%20Premier%20Field%20Engineer%20at%20Microsoft%20Russia%20and%20today%20I'm%20gonna%20tell%20you%20a%20real-world%20story%20that%20happened%20recently.%20Long%20story%20short%2C%20a%20customer%20asked%20me%3A%20%22How%20do%20I%20understand%20why%20the%20System%20process%20is%20consuming%20100%25%20of%20a%20single%20CPU%20core%20on%20my%20machine%3F%22%20%3CBR%20%2F%3E%3CBR%20%2F%3EWhenever%20I%20see%20description%20or%20request%20like%20this%2C%20my%20first%20step%20is%20to%20collect%20ETW%20trace.%20In%20the%20past%2C%20I%20would%20send%20a%20long%20instruction%20how%20to%20install%20%3CSTRONG%3E%20Windows%20Performance%20Toolkit%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Ftest%2Fwpt%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Ftest%2Fwpt%2F%20%3C%2FA%3E%20and%20how%20to%20use%20%3CSTRONG%3E%20xperf%20%3C%2FSTRONG%3E%20with%20appropriate%20kernel%20flag%20to%20collect%20data%2C%20but%20these%20days%2C%20thanks%20to%20PG%2C%20I%20don't%20need%20to%20do%20that%20anymore.%20Since%20very%20first%20release%20of%20Windows%2010%2FWindow%20server%202016%20%E2%80%93%20WPR%20(Windows%20Performance%20Recorder)%20with%20a%20lot%20of%20predefined%20profiles%20shipped%20with%20the%20OS.%20So%2C%20all%20we%20need%20is%20%E2%80%93%20collect%20short%20trace%20at%20the%20very%20exact%20moment%20when%20problem%20exist.%20In%20this%20case%20we%20used%20%3CSTRONG%3E%20CPU%20%3C%2FSTRONG%3E%20profile%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%20Wpr%20-start%20CPU%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CWAIT%2010-15%3D%22%22%20seconds%3D%22%22%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%20Wpr%20-stop%20C%3A%5Ctemp%5Ctrace.etl%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20soon%20as%20customer%20provided%20the%20trace%2C%20I%20opened%20it%20in%20WPA%20(Windows%20Performance%20Analyzer).%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20CPU%20is%20busy%20indeed%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113501i70AE2A8B2E86A763%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ETop%20CPU%20consumer%20%E2%80%93%20System%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113506i419186739F2BBBAA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20System%20process%20has%20multiple%20threads%2C%20but%20only%20one%20TID%20(%2376)%20is%20very%20active%20and%20consuming%20CPU%20time%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113509i105EB07A7635DB0D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EWith%20public%20symbols%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fdesktop%2Fdxtecharts%2Fdebugging-with-symbols%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fdesktop%2Fdxtecharts%2Fdebugging-with-symbols%20%3C%2FA%3E%20we%20can%20go%20deeper%20and%20review%20function%20called%20in%20this%20thread%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20998px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113510iFA73925E8CF0B529%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%20ntoskrnl.exe!KeBalanceSetManager%20%3C%2FSTRONG%3E%20huh%2C%20time%20to%20remember%20what%20I've%20read%20in%20Windows%20Internals%20back%20in%20a%20days.%20On%20page%20188%20of%20the%20second%20part%20of%20Windows%20Internals%206%20%3CSUP%3E%20th%20%3C%2FSUP%3E%20version%2C%20you%20can%20find%20explanation%20of%20this%20function%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20%3CEM%3E%20balance%20set%20manager%20%3C%2FEM%3E%20(%20%3CEM%3E%20KeBalanceSetManager%20%3C%2FEM%3E%20%2C%20priority%2016).%20It%20calls%20an%20inner%20routine%2C%20the%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CEM%3E%20working%20set%20manager%20(MmWorkingSetManager)%20%3C%2FEM%3E%20%2C%20once%20per%20second%20as%20well%20as%20when%20free%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Ememory%20falls%20below%20a%20certain%20threshold.%20The%20working%20set%20manager%20drives%20the%20overall%20memory%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Emanagement%20policies%2C%20such%20as%20working%20set%20trimming%2C%20aging%2C%20and%20modified%20page%20writing.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHmm%2C%20it%20looks%20like%20they%20are%20facing%20memory%20related%20problems%2C%20but%20they%20didn't%20mention%20it%2C%20and%20the%20initial%20request%20was%20about%20high%20CPU%20consumption%20by%20System%20process.%20Let's%20look%20at%20the%20memory%20info%20that%20we%20have%20in%20the%20trace%2C%20which%20isn't%20much%20since%20we%20used%20the%20CPU%20profile%2C%20but%20at%20least%20let's%20give%20it%20a%20try.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113511i24A1BB4F140AFE29%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EAccording%20to%20info%20in%20the%20trace%2C%20this%20box%20has%204.9GB%20in%20Zero%20and%20Free%20lists%2C%20and%202.7GB%20in%20Standby%20Lists%2C%20which%20gives%20us%207.6GB%20available%20memory%E2%80%A6confusing%2C%20isn't%20it%3F%20It%20looks%20like%20this%20box%20has%20plenty%20of%20available%20memory%2C%20but%20system%20calls%20%3CSTRONG%3E%20KeBalanceSetManager%20%3C%2FSTRONG%3E%20routine%20every%20second%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113512iA70C2531FD848AE8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EAlso%2C%20if%20you%20take%20a%20closer%20look%20at%20memory%20utilization%2C%20you%20can%20see%20that%20the%20Page%20Pool%20Commit%20is%20around%2011.9GB%2C%20which%20is%20a%20lot%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113513iC8B4D58FA6DE5284%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20is%20are%20some%20good%20articles%20to%20read%20on%20this%20area%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fblogs.technet.microsoft.com%2Fmarkrussinovich%2F2009%2F03%2F10%2Fpushing-the-limits-of-windows-paged-and-nonpaged-pool%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fblogs.technet.microsoft.com%2Fmarkrussinovich%2F2009%2F03%2F10%2Fpushing-the-limits-of-windows-paged-and-nonpaged-pool%2F%20%3C%2FA%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fdesktop%2Fmemory%2Fmemory-pools%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fdesktop%2Fmemory%2Fmemory-pools%20%3C%2FA%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ETotal%20installed%20RAM%20on%20this%20box%20%E2%80%93%2032GB%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113514i7955E913125B39C0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20looks%20like%20we%20need%20a%20better%20look%20at%20what's%20happening%20in%20memory%E2%80%A6the%20best%20way%20to%20do%20that%20%E2%80%93%20memory%20dump.%20In%20this%20case%20we%20decide%20to%20try%20generating%20mirror%20memory%20dump%20via%20%3CSTRONG%3E%20livekd.exe%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsysinternals%2Fdownloads%2Flivekd%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsysinternals%2Fdownloads%2Flivekd%20%3C%2FA%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20with%20that%20in%20mind%2C%20I%20asked%20the%20customer%20to%20grab%20a%20dump%20by%20executing%20%3CSTRONG%3E%20livekd%20-ml%20-o%20C%3A%5Ctemp%5Cm.dmp%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ENext%20I'll%20use%20WinDbgX%20aka%20WindDbg%20preview%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fdebugger%2Fdebugging-using-windbg-preview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fdebugger%2Fdebugging-using-windbg-preview%20%3C%2FA%3E%20and%20the%20Mex%20extension%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D53304%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D53304%20%3C%2FA%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ELet's%20start%20by%20reviewing%20virtual%20memory%20states%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113515i96963F595BD1FFF4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EFrom%20here%20we%20can%20see%20that%20the%20PagedPool%20Commit%20%3D%2011.95GB%2C%20but%20the%20PagedPool%20usage%20is%20zero%2C%20I%20assume%20it's%20because%20we%20used%20mirror%20dump.%20Anyway%2C%20from%20this%20data%20we%20clearly%20see%20that%20we%20definitely%20have%20a%20memory%20issue%20since%20Available%20pages%20%3D%202.87MB%20and%20there%20are%20a%20lot%20pool%20allocation%20failures.%20First%20let's%20see%20first%20memory%20usage%20by%20process%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20969px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113516i7A251CFB615E375B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EHeh%2C%20SynTPEnh.exe%20consumed%209.48GB%20of%20RAM%2C%20very%20well.%20Now%20let's%20see%20what's%20in%20Paged%20Pool%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20997px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113517iD8BDC9D938B87617%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EHmm%2C%20bunch%20of%20Token%20objects%2C%20let's%20shed%20some%20light%20and%20dump%20them%20all%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20995px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113518iA2A77086FCC663B2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EAgain%20SynTPEnh.exe%2C%20let's%20calculate%20all%20token%20handles%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20988px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113519iA2E1E8F3265A99D9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EKeeping%20in%20mind%20that%20every%20handle%20gives%20us%20about%208%20rows%2C%20so%20we%20need%20to%20divide%20it%20and%20get%20in%20total%20about%20160k%20handles%2C%20which%20is%20a%20lot%2C%20and%20almost%20all%20of%20them%20belong%20to%20SynTPEnh.exe.%20%3CBR%20%2F%3E%3CBR%20%2F%3EOn%20the%20customer%20machine%2C%20the%20application%20event%20log%20was%20full%20of%20events%20like%20this%20one%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20991px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113521i9D99504FAF05FA63%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20the%20next%20step%20is%20to%20check%20if%20there%20are%20any%20%22zombie%20processes%22%20%3CA%20href%3D%22https%3A%2F%2Frandomascii.wordpress.com%2F2018%2F02%2F11%2Fzombie-processes-are-eating-your-memory%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Frandomascii.wordpress.com%2F2018%2F02%2F11%2Fzombie-processes-are-eating-your-memory%2F%20%3C%2FA%3E%20%2C%20and%20we%20can%20see%20a%20lot%20of%20them%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20983px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113522i825BAA93EBEBE345%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20majority%20of%20the%20zombie%20processes%20are%20in%20session%201%2C%20which%20is%20not%20in%20used%20in%20this%20case%20since%20the%20customer%20is%20using%20RDP%20to%20connect%20to%20this%20machine%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20983px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113523i87F489288D02E2E4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20customer%20said%20that%20on%20this%20tower%2C%20there%20weren't%20any%20pointing%20devices%20except%20a%20mouse%2C%20so%20it%20was%20safe%20to%20uninstall%20it%20and%20check.%20After%20uninstallation%20memory%20consumption%20immediately%20went%20down%2C%20and%20there%20was%20nothing%20to%20do%20for%20the%20system%20process%2C%20so%20it%20goes%20almost%20Idle.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20%3CSTRONG%3ESo%20what%20was%20our%20root%20cause%3F%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20some%20reason%20the%20process%20SynTPEnh.exe%20was%20being%20created%20every%204%20seconds%2C%20do%20some%20work%20for%20about%201%20sec%2C%20and%20then%20crash.%20The%20token%20handle%20from%20parent%20services%20that%20started%20this%20process%20is%20not%20released%2C%20which%20leads%20us%20to%20memory%20leak%20and%20high%20CPU%20consumption.%20Here%20is%20an%20example%20from%20the%20trace%20that%20process%20SynTPEnh.exe%20come%20and%20go%20all%20the%20time%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20991px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113524i5ED831DE238805D4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3EWbr%2C%20Konstantin.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FWAIT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-571035%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edebug%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edebugging%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ekonstantin%20chernyi%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPerformance%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eproudmicrosoftemployee%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindbg%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindbgx%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20performance%20analyzer%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20performance%20recorder%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20performance%20toolkit%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewpa%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewpr%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewpt%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Experf%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-753698%22%20slang%3D%22en-US%22%3ERe%3A%20Let%20me%20Count%20the%20Ways%3A%20Determining%20Why%20the%20System%20Process%20Consumes%20100%25%20of%20a%20Single%20CPU%20Core%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-753698%22%20slang%3D%22en-US%22%3E%3CP%3EWow!%20Great%20post%20Konstantin!%20Excellent%20find!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

First published on TECHNET on Mar 26, 2019


NOTE: This blog is going through a specific issue in order to help show the steps involved in troubleshooting this type of issue. The process name(s) referenced in this content, except for System, can be any process, and not just the process used as an example in this post, and in no way are there expectations, no is it implied, that this particular process will cause you any problems!




Hey everyone, Konstantin Chernyi here. I'm a Premier Field Engineer at Microsoft Russia and today I'm gonna tell you a real-world story that happened recently. Long story short, a customer asked me: "How do I understand why the System process is consuming 100% of a single CPU core on my machine?"

Whenever I see description or request like this, my first step is to collect ETW trace. In the past, I would send a long instruction how to install Windows Performance Toolkit
https://docs.microsoft.com/en-us/windows-hardware/test/wpt/ and how to use xperf with appropriate kernel flag to collect data, but these days, thanks to PG, I don't need to do that anymore. Since very first release of Windows 10/Window server 2016 – WPR (Windows Performance Recorder) with a lot of predefined profiles shipped with the OS. So, all we need is – collect short trace at the very exact moment when problem exist. In this case we used CPU profile:

Wpr -start CPU


<wait 10-15 seconds, so we have enough information>

Wpr -stop C:\temp\trace.etl


As soon as customer provided the trace, I opened it in WPA (Windows Performance Analyzer).

The CPU is busy indeed:



Top CPU consumer – System:



The System process has multiple threads, but only one TID (#76) is very active and consuming CPU time:



With public symbols https://docs.microsoft.com/en-us/windows/desktop/dxtecharts/debugging-with-symbols we can go deeper and review function called in this thread:



ntoskrnl.exe!KeBalanceSetManager huh, time to remember what I've read in Windows Internals back in a days. On page 188 of the second part of Windows Internals 6 th version, you can find explanation of this function:

The balance set manager ( KeBalanceSetManager , priority 16). It calls an inner routine, the


working set manager (MmWorkingSetManager) , once per second as well as when free


memory falls below a certain threshold. The working set manager drives the overall memory


management policies, such as working set trimming, aging, and modified page writing.


Hmm, it looks like they are facing memory related problems, but they didn't mention it, and the initial request was about high CPU consumption by System process. Let's look at the memory info that we have in the trace, which isn't much since we used the CPU profile, but at least let's give it a try.



According to info in the trace, this box has 4.9GB in Zero and Free lists, and 2.7GB in Standby Lists, which gives us 7.6GB available memory…confusing, isn't it? It looks like this box has plenty of available memory, but system calls KeBalanceSetManager routine every second:



Also, if you take a closer look at memory utilization, you can see that the Page Pool Commit is around 11.9GB, which is a lot:



Here is are some good articles to read on this area:

https://blogs.technet.microsoft.com/markrussinovich/2009/03/10/pushing-the-limits-of-windows-paged-...

https://docs.microsoft.com/en-us/windows/desktop/memory/memory-pools

Total installed RAM on this box – 32GB:



It looks like we need a better look at what's happening in memory…the best way to do that – memory dump. In this case we decide to try generating mirror memory dump via livekd.exe
https://docs.microsoft.com/en-us/sysinternals/downloads/livekd

So with that in mind, I asked the customer to grab a dump by executing livekd -ml -o C:\temp\m.dmp


Next I'll use WinDbgX aka WindDbg preview https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview and the Mex extension https://www.microsoft.com/en-us/download/details.aspx?id=53304

Let's start by reviewing virtual memory states:



From here we can see that the PagedPool Commit = 11.95GB, but the PagedPool usage is zero, I assume it's because we used mirror dump. Anyway, from this data we clearly see that we definitely have a memory issue since Available pages = 2.87MB and there are a lot pool allocation failures. First let's see first memory usage by process:



Heh, SynTPEnh.exe consumed 9.48GB of RAM, very well. Now let's see what's in Paged Pool:



Hmm, bunch of Token objects, let's shed some light and dump them all:



Again SynTPEnh.exe, let's calculate all token handles:



Keeping in mind that every handle gives us about 8 rows, so we need to divide it and get in total about 160k handles, which is a lot, and almost all of them belong to SynTPEnh.exe.

On the customer machine, the application event log was full of events like this one:



So the next step is to check if there are any "zombie processes" https://randomascii.wordpress.com/2018/02/11/zombie-processes-are-eating-your-memory/ , and we can see a lot of them:



The majority of the zombie processes are in session 1, which is not in used in this case since the customer is using RDP to connect to this machine:



The customer said that on this tower, there weren't any pointing devices except a mouse, so it was safe to uninstall it and check. After uninstallation memory consumption immediately went down, and there was nothing to do for the system process, so it goes almost Idle.

So what was our root cause?


For some reason the process SynTPEnh.exe was being created every 4 seconds, do some work for about 1 sec, and then crash. The token handle from parent services that started this process is not released, which leads us to memory leak and high CPU consumption. Here is an example from the trace that process SynTPEnh.exe come and go all the time:



Wbr, Konstantin.

1 Comment
Established Member

Wow! Great post Konstantin! Excellent find!