Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ConEmu causing kernel debug log to fill #1236
ConEmu build: 170819 alpha x64
Something in ConEmu64 is causing ConhostV2.dll to issue dozens of kernel debugger messages every second. That makes it very difficult to do any kind of debug log monitoring on this system.
The messages are coming from the conhost.exe process that ConEmu launches. Strictly speaking, that's not your process, but the problem does not happen when cmd.exe is run by itself, and it also launches conhost.exe.
Steps to reproduce
(14952 is the process ID for the conhost.exe process that ConEmu launches. If I have multiple tabs, I get these messages for each conhost.)
I have the same issue. Moreover I have a PC and a laptop. And issue happens only on laptop. But I have same ConEmu on both (settings for conEmu are also identical).
This forces me to close conEmu any time I need to debug as conhost spawned by ConEmu generates ~3K messages per second.
Also connhost thread where issue happens puts extra load on CPU (4% comparing to 0.01% on machine where no issue)
Stack trace for thread where issue happens:
00000001 0.00000000  windows\core\console\open\src\server\apidispatchersinternal.cpp(21)\ConhostV2.dll!00007FF90C6607E6: (caller: 00007FF90C660628) ReturnHr(35848764) tid(5d0) 80004001 Not implemented
It looks like ConEmu is polling the private API GetConsoleKeyboardLayoutName in a tight loop. This API is private and isn't supported for public calls. I need ConEmu to stop calling it when it receives the message that it is unimplemented.
00000003 0.00007577  windows\core\console\open\src\server\apidispatchers.cpp(544)\ConhostV2.dll!00007FF90C65E7C4: (caller: 00007FF90C660628) ReturnHr(35848765) tid(5d0) 80070006 The handle is invalid.
This one is ConEmu calling GetConsoleDisplayMode public API in a tight loop. It doesn't look like this API allows passing of a handle, so I will file a bug and investigate why the handle seems to be suddenly invalid. MSFT: 13479101
I would like to fix this bug and submit a PR. What I have found is that the call to
So ConEmu could key off that return code and never call the API again after it hits that. There are a handful of places where this function gets dynamically loaded and called, but the one that calls over and over is in
So should I...
(a) Change only the function IsKeyboardLayoutChanged, have it recognize the error code, set a static variable to not make the call any more.
(b) Make a wrapper function for GetConsoleKeyboardLayoutName that can make it so none of the other places get called multiply as well. Change all the other locations to call this wrapper.
Of course it would be much better if console applications have proper API to determine the keyboard layout. Nowadays there is absolutely no way to do that. Standard GUI functions aren't working for obvious reason, console variant was broken in Win10.