/ ConEmu Public

# keyboard delay, only on one machine#297

Closed
opened this issue Aug 25, 2015 · 64 comments
Closed

# keyboard delay, only on one machine #297

opened this issue Aug 25, 2015 · 64 comments

### DerellLicht commented Aug 25, 2015

 I am using ConEmu on two machines, both Win7/64bit. Both computers are Core-i7. All consoles within ConEmu are tcc/le V13.06.77 ConEmu is 150816, but with the 150821xxx dlls that were distributed a couple of days ago. I have 'Inject ConEmuHk' disabled. On my work machine, I have 9 consoles open, and it works fine; when I type keys in a console, they appear immediately. Everything is fine. However, on my home machine, which is actually a faster machine, I have only 3 consoles open, but when I type keys, there is a 1-second or so delay after each key, before it appears on the screen. This is very awkward!! BTW, when I open stand-alone tcc/le sessions, even with 3 open, there is no keyboard delay; I've also tested same configuration with ConsoleZ, which is also working normally. This appears to be an artifact of ConEmu (but only on this machine!) Have you heard of anything like this before? Is there anything I can do to fix it? The text was updated successfully, but these errors were encountered:

### Maximus5 commented Aug 25, 2015

 Dlls must match executable. This is not a constructor. Try to run ConEmu with default switches. I doubt that with same conditions you may observe problem on certain PC only. ConEmu.exe -basic  Try to create http://ConEmu.github.io/en/LogFiles.html. They are interesting, of course, with reproduced lags. Try to run tcc in ConEmu tabs as following. Does the "sleep" prefix appear in the title? set ConEmuSleepIndicator=TITLE & tcc 

### DerellLicht commented Aug 25, 2015

 I will try these this evening, when I get home.

### DerellLicht commented Aug 27, 2015

 Well, these experiments were interesting, if not enlightening (at least to me) !!! So first, I opened a stand-alone tcc session to follow the preceding instructions... cd \ConEmu ConEmu64 -basic -log4 setConEmuSleepIndicator=TITLE & c:\tccle13\tcc log files were created in \ConEmu, but I'll hold off uploading them, to see if they are of any value to you. I then opened two other tcc's in new consoles in this session, and changed all of them to the same directories that I had in my failing example. There are not keyboard delays in any of those sessions!!! dammit... I went into settings and turned off ConEmuHk (I need this off at work, so my compilers will run; I may not actually need it here). There were still no keyboard delays. Oh, there were no 'sleep' indicators on title bar I then opened my taskbar link which opens all terminals automatically - and the keyboard delays are still present in that session!! Since my current log files are from the non-troubled session, I assume they are not useful?? I'll try adding -log4 to my startup script on the failing link, and see what happens...

### DerellLicht commented Aug 27, 2015

 Okay, -log4 worked in my troubled session. I then typed a (delayed) command in two of the three consoles. Here is the log file: https://www.dropbox.com/s/ydc38m52utyymg9/ConEmu-input-6048.log?dl=0

### Maximus5 commented Aug 27, 2015

 I'm lost in your information. I need logs (with -log switch) for problematic session and description of what was you doing. Screenshots may be usefull too. Forcing top logging level is superfluous and may interfere with normal program behavior. So use simple -log instead of -log4. I need all created files, you've uploaded a single one. Useless alone. http://conemu.github.io/en/LogFiles.html#Posting_to_issues Seems like when you use -basic switch there are no lags, but without switch - lags exist? Compare settings.

### DerellLicht commented Aug 27, 2015

 Okay, I'll try with -log instead. I only enclosed 1 log file, because only 1 log file was created!! That was the entire contents of the directory. I'm not sure what -basic does; should I use that in my regular startup command? I guess I'll try it and see what happens.

### DerellLicht commented Aug 27, 2015

 I ran my startup script with -log -basic; my actual starting command is this: C:\ConEmu813\ConEmu64.exe -log -basic /cmd @c:\ConEmu813\ref.files\conemu.startup.txt where conemu.startup.txt is: c:\tccle13\tcc cdd C:\home "-new_console:t:Home" c:\tccle13\tcc cdd C:\Users\ascender\Downloads "-new_console:t:Files" c:\tccle13\tcc cdd C:\notes "-new_console:t:Notes" and with this configuration, I still have the keyboard problem; interestingly, when I run this command, the log files end up in c:\ConEmu813, rather than in a directory on my Desktop. Here are the log files: https://www.dropbox.com/s/f3rrkqw9bj3qci9/ConEmu.logs.0827.zip?dl=0 BTW, I installed ConEmu 813, to eliminate the issue of mixing dlls from different version, which had been mentioned in early posts on this thread. The dll files are current in this installation.

### DerellLicht commented Sep 12, 2015

 Well, I tried out the current release (150910), but it still has the keyboard-delay problem... though the crashes are gone, fortunately. Sadly, I now have the same experience on both my home and work machines (with my first version, the work machine did not have the keyboard delays, even though more consoles were open). With 150910, I tried both my startup script that I used previously, and I also tried a batch file based on your Example4: :: Remove line breaks after paste! start "ConEmu" "C:\ConEmu\ConEmu64.exe" /cmdlist ^|^|^| c:\tccle13\tcc cdd C:\home "-new_console:t:Home"^|^|^| c:\tccle13\tcc cdd C:\Users\ascender\Downloads "-new_console:t:Files"^|^|^| c:\tccle13\tcc cdd C:\notes "-new_console:t:Notes" This also opened all the windows successfully, but some (not all) of the consoles have the keyboard delay... that is very odd; in the above example, consoles 1 and 2 had delay, 3 did not. At work, where I had 7 consoles opened, some had delay and some didn't, but it was not every third window that was good, I checked for that. I didn't write down the numbers though... If I open one console at a time, using the 'Create new console' menu item, all work fine. However, that defeats any reason for me to use ConEmu. Let me clarify: I've been using Console2/ConsoleZ for years now, and it works quite fine. I occasionally find a bug, which the ConsoleZ maintainer promptly fixes... with one exception.. several of us have been begging for an option to remember a session (with multiple consoles) and automatically open them all with one command. For some reason, he won't do this. This is the only reason I looked at ConEmu, and I love that feature!!!! It works wonderfully, and is sufficient benefit (especially at work) for me to learn a new program... but only if it is usable. I NEED a fix for this keyboard delay!! It is not usable like this... I will of course, collect and submit any log files that may be of use to you...

### DerellLicht commented Sep 12, 2015

 Oh!! Okay, I re-ran my previous command script and collected log files: https://www.dropbox.com/s/x8zzatyozgaph0v/ConEmu.logs.0911.zip?dl=0

### Maximus5 commented Sep 12, 2015

 Did you close the issue by accident?

### Maximus5 commented Sep 12, 2015

 I would like to fix the bug, and moreover it was reported already, but unfortunately I can't reproduce it on any PC I have. So it's still pending...

### Maximus5 commented Sep 12, 2015

 Here is an old issue I mentioned Maximus5/conemu-old-issues#1590

### Maximus5 commented Sep 12, 2015

 Please, attach your settings and show screenshots. Also, have your tried to change options in the CPU consuming group?

### DerellLicht commented Sep 12, 2015

 yep, old issue looks same as my issue. ConEmu.xml is here: https://www.dropbox.com/s/jg4vhrxt1vmmh9c/ConEmu.xml?dl=0 BTW, I installed by unzipping .7z file into empty c:\ConEmu ... don't know if that matters, but anyway.

reopened this Sep 12, 2015

### DerellLicht commented Sep 12, 2015

 I'm looking over the old thread and trying things mentioned there... I can fix problem by adding to each line in startup script: *set ConEmuSleepIndicator=TITLE & but then I have to answer the UAC question for every tab, which is a hassle. Then I tried set ConEmuSleepIndicator=TITLE & on each line; at first, seemed like that worked, but after a few seconds the slow tabs slowed down again. What are you looking for in screenshots?? I can't really demonstrate the delay. Do you want screenshot of every tab, or just a slow one, or which?

### DerellLicht commented Sep 12, 2015

 BTW, sorry about closing the issue earlier; I was confused by the two buttons 'close and comment' vs 'comment' ... I thought it would just close the window... duh.

### Maximus5 commented Sep 12, 2015

 Asterisk before command has exact meaning - run tab as admin. Screenshot may give me some idea, or may not. Anyway, it would show me how ConEmu window appears on your side. There is also an option to add delay between console creation - AFAICR it helped others.

### DerellLicht commented Sep 12, 2015

 Where/how is the delay specified?? I tried ConEmuSleepIndicator=TITLE on each line, but didn't see any indicators on any tabs. screen shot: https://www.dropbox.com/s/dfcih8v0dt4s6dm/ConEmu.screenshot.jpg?dl=0

### DerellLicht commented Sep 12, 2015

 Sorry, I don't understand?? How do I utilize this option?? I tried set StartCreateDelay=1000 In Startup:EnvironmentVariables, but I don't think it did anything, consoles all opened immediately. Can I put at beginning of my command file?? I'll try that...

### Maximus5 commented Sep 12, 2015

 The option may be changed in ConEmu.xml directly.

### DerellLicht commented Sep 12, 2015

 well, putting in the .Vanilla section, right after ColorTableNN, did not create any delays between opening consoles; I'm assuming the units of this field are milliseconds... does it go in some other section?? I also tried putting it after "DefaultBufferHeight" later in the file, no effect with either, and the keyboard delays are still present.

### Maximus5 commented Sep 12, 2015

 Here is slightly modified ConEmu.xml uploaded by you: https://gist.github.com/Maximus5/2be8f5a3f55f70f1184e It starts four tabs, delay 2 seconds between their initialization. NB, delay is done between creation of "tcc.exe processes", not tabs. NB, I've set up %PATH% variable to run tcc without path, check Environment setting page.

### Maximus5 commented Sep 12, 2015

 Can you show screenshot of Info page during you typing something? Smth like this... Does the problem persists if you shrink the windows size?

### DerellLicht commented Sep 13, 2015

 Okay, first, when I run ConEmu64 using your ConEmu.xml, the delay is not present... Cool!!! of course, the start directory and tab labels are not what is wanted, but that's not important now!! I'll test out the patch that you just posted, using my original .xml file, and collect your Info screen dump as well... be back in a bit.

### DerellLicht commented Sep 13, 2015

 Whoa!!!!!!!!!!!! I went back to my original ConEmu.xml, and merely added your StartCreateDelay record immediately under .Vanilla record... And the delay is completely gone!!! In all three tabs... I'm going to try adding some more tabs and test this some more... I'll also test with your new patch, and without the StartCreateDelay, to see what the patch does... be back in a bit.

### DerellLicht commented Sep 13, 2015

 Okay, observations: with 150910a patch, if StartCreateDelay is removed from ConEmu.xml, the delay is still present. With StartCreateDelay present in the right place, and set to 1000 msec, delay is gone and program works fine... this is already something I am happy to live with, though I need to test on my work machine as well... at work I typically have 7 to 10 consoles that I need to start after a reboot, but a 10 or 15 second start time will not break my brain!! if StartCreateDelay is reduced to 1/2 second (0x1F4) though, the delay returns, so looks like 1 second is minimum delay on this machine. Okay, let me go collect the Info screen; I'm assuming you want this from a failing run...

### johngull commented Oct 19, 2015

 Additional information for this bug. I have this slowing also. But it appears not from the begin, but only after some time conemu worked (i have 3 tabs: far + 2 consoles). After conemu restart all works fine again. And in some time it become slow.

### Maximus5 commented Oct 19, 2015

 @johngull Show screenshot of (Settings/Info) during typing, when it becomes slow. Sort of this comment

### johngull commented Oct 20, 2015

 Here is it: By the way, this time it happens right from the start.

### Maximus5 commented Oct 20, 2015

 @johngull So, you have to increase "Delay" on "Startup" page.

### johngull commented Oct 21, 2015

 Sorry, but i not see any delay value there.

### Maximus5 commented Oct 21, 2015

 Switch to alpha https://conemu.github.io/en/OldBuild.html

### johngull commented Oct 21, 2015

 Ok, changing of delay to 2000 helped with the slowing from the start. But still after keeping ConEmu opened for some hours make it slow:

### Maximus5 commented Oct 21, 2015

 I consider this is Microsoft conhost bug. But due to indefinite reproduction conditions nobody can be sure... Slowness appears when you run existing tabs for hours? Or when you run new tab in running ConEmu window?

### johngull commented Oct 21, 2015

 I not add any new tab. I just open conemu with 3 tabs (far + 2 git shells). And when it works for hours (stays visible on second display - who knows, maybe important :) ) it becomes slow.

### M0ns1gn0r commented Dec 23, 2015

 Had the same problem as the topic starter: lags after simultaneous opening of multiple consoles. Solved with 2000 ms in StartCreateDelay.

### M0ns1gn0r commented Dec 23, 2015

 Windows 7 x64, latest ConEmu and Cmder.

### dakotahawkins commented Jan 4, 2016

 fwiw, I have the same issue as @johngull. Only happens with my ms cmd tabs, takes a long time to happen. I've just gotten used to closing them and re-opening new ones.

### Elfy commented Jan 10, 2016

 Same issue. In addition to what I said here Maximus5/conemu-old-issues#1590 (comment) I tested it in fresh Win7x64 install with minimal configuration (just two cmd tabs). I can reproduce the problem. It happens not on every run, but often enough. (It happened on every run with update on startup on, but I wanted to reproduce it with as little junk in the logs as possible.) Here are config and log files from problematic run. https://dl.dropboxusercontent.com/u/55700542/bad_conemu_session_logs.zip The interesting part is in ConEmu-input-2896.log Messages like 23:04:57.405 Searching for conhost More than one created conhost.exe was found! More than one created conhost.exe was found! 23:04:57.905 ConHostPID=0 appear about once a second, which coincides with apparent refresh rate of slow tab. It is also very different from log of a normal tab.

### Maximus5 commented Jan 10, 2016

 These lines are expected in Windows 7. Disable automatic updates to get rid of them and get "clean" tests.

### Elfy commented Jan 10, 2016

 These logs are made with updates turned off. These lines are not present when all tabs function properly. Normal behaviour is 22:36:50.364 Searching for conhost 22:36:50.426 ConHostPID=1840 in one tab and 22:36:49.411 Searching for conhost More than one created conhost.exe was found! 22:36:49.739 ConHostPID=1020 in another. Note that PID is not zero in this case and these messages do not get repeated every second either.

### Maximus5 commented Jan 11, 2016

 Build 160111

### Elfy commented Jan 12, 2016

 Works for me. Delays are gone. Thanks! The logs still show ConHostPID=0 though. It seems it can not detect PID of associated conhost when multiple tabs are opened simultaneously. Could it cause problems elsewhere later or is it a nonissue? I'm afraid to dig too deep in the code myself :) BTW, there is a way to find exactly which conhost process is associated with specific console app, though it is a bit of a black magic. Would it be beneficial to implement?

### Maximus5 commented Jan 12, 2016

 There is no way to detect associated conhost in Windows 7. Actually, conhost are detected generally for informational and debugging purposes, so "conhost=0" must not harm anything.

### Elfy commented Jan 12, 2016

 There is, check my repository if you are curious. I did it to manipulate kb layout in console apps from AHK script. But it relies on some undocumented Windows API and I think it might break in some cases because of security issues, so it's not worth the trouble if it's not really useful.

### Maximus5 commented Jan 12, 2016

 OK, that's interesting, what repo do you mean? It may not be "broken" probably, because since Windows 8 conhost is spawned from console application process and this trick us not required anymore.

### Elfy commented Jan 12, 2016

 I mean this https://github.com/Elfy/getconkbl The high-level overview is -- find all conhost processes, get all handles in the system (NtQuerySystemInformation), filter handles to processes, which are owned by conhost processes, duplicate them and do GetProcessId(). See if it matches PID of the app.

### Maximus5 commented Jan 12, 2016

 @Elfy After short look into your code... Yep, it's an interesting exercise, but seems like all your application may be converted into two API function calls: AttachConsole and GetConsoleKeyboardLayoutName. Last one is undocumented, yep.

### Maximus5 commented Jan 12, 2016

 Anyway, I suppose this issue is solved. If anyone still has problems, please report.

### M0ns1gn0r commented Jan 12, 2016

 @Maximus5 Do you mean the StartCreateDelay workaround is not needed anymore?

### Maximus5 commented Jan 12, 2016

 Yes, I suppose so.

### Elfy commented Jan 12, 2016

 @Maximus5 I think back then the problem of finding associated conhost process fascinated me so much that I've never got to look for a simpler solution :) I'll keep GetConsoleKeyboardLayoutName in mind. @M0ns1gn0r Yes, works for me even with default delay.

added a commit that referenced this issue Jan 14, 2016
 Internal. Add note about possible way to determine conhost pid via so… 
 83b0715 
…me hacks

#297 (comment)
mentioned this issue Feb 5, 2017