cmder: [Bug] cmder loads very slowly under Windows
Version Information
Cmder version: v1.3.21 (1.3.20.151)
Clink: v1.4.11
git: version 2.39.1.windows.1
ConEmu: 221218 [64] Stable
Operating system: Windows 10 Pro 22H2 (Build 19045.2486)
Cmder Edition
Cmder Full (with Git)
Description of the issue
Since the latest Windows 10 update 22H2, it takes 30 seconds or more for cmder to load. It also takes this long when creating new tab windows in cmder. The problem exists with different Windows 10 computers at different work spaces and locations (private, work and Home Office).
How to reproduce
No response
Additional context
No response
Checklist
- I have read the documentation.
- I have searched for similar issues and found none that describe my issue.
- I have reproduced the issue on the latest version of Cmder.
- I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 15
- Comments: 168 (83 by maintainers)
This also solves the problem for me đ Now itâs an instant startup. @d4k0 , good catch!!
Donât know if it helps but starting Cmder I can see rotating cmd.exe and findstr.exe in the lower tab:
Happens on my Windows 10 Pro private PC and my Windows 11 Pro office PC. On the office PC the startup takes significant more time than on the Win 10 machine.
I tried it and it significantly reduces startup time (17s vs 5s). Great work!
I can confirm that the cause is ESETâs âDeep Behavioral Inspectionâ. I installed ESET in a VM and then the startup time of Cmder Mini (latest build) was also suddenly 5s.
After disabling âDeep Behavioral Inspectionâ the startup time is about 0.7s.
But since this is not a permanent solution for me, I played around with the exceptions and probably found a solution. It is enough to add the path to cmd.exe (C:\Windows\System32\cmd.exe) under the exceptions for âDeep Behavioral Inspectionâ.
If I add ALSO the folder of Cmder there, the startup time does not improve further. If I ONLY add the folder of Cmder, the startup time improves only minimally (about 0.5s faster, about 4.5s in total).
The question now is: is the cause due to a Windows update (patch day was January 10) or was it due to the last ESET program update on January 16? I have been using ESET for a year now and never had any problems with it in conjunction with Cmder until mid-January. Iâm just a little puzzled that the cmd.exe exception âsolvesâ the problem. Maybe we should inform ESET support?
I guess we need to start asking specifically which antivirus are you running when people report slownes
Seems like a bit of a pattern here to me.
@d4k0 ah, a smoking gun đ yes a Jan 16 update of ESET fits the timeline with the first report here on Jan 18.
Yes, I would definitely recommend informing ESET support about this severe performance problem.
Also, a sidebar â itâs is an interesting point for troubleshooters to be aware of for future issues: protection suites may require multiple actions to turn them off to the point where theyâre doing zero work. Until theyâre doing zero work, theyâre not really âturned offâ enough to rule out whether theyâre contributing to or causing the problem. Unfortunately, since each suite is different, it might take a bit of Q&A in each incident to identify which suite is in use and how to fully turn it off.
On Jan 24 @andrej-dyck said âI turned off my antivirus software; still slow.â I expect that test probably suffered the same wrinkle that occurred in @mtaki14 's test where pausing protection doesnât fully turn off the ESET suite, and the Host-based Intrusion Prevention System remains on (and also a reboot might be necessarily when turning off ESET for it to fully take effect).
More improvements in #2825
%cmder_root%\vendor\user_init.optional.cmd
%cmder_root%\vendor\init.bat
that gives the user complete control if they want it.master
->more_speed_2
->more_speed_2 with user_init.cmd
below with/t
only:Downloads here
Yes, thatâs interference from antivirus/etc.
There arenât any CMD commands between those two
echo
commands, but there is the end)
after finishing theif defined git_locale ( ... )
block that was just evaluated withenabledelayedexpansion
. That)
triggers a bunch of system API calls and file IO for opening the .bat file again and parsing a next command, and getting/setting the console title, and a bunch of other minutia that involve system APIs.The antivirus/etc software is intercepting one or more of the APIs and decides that it wants to do some extra processing, and the extra processing takes a bunch of time.
I agree that it doesnât make sense why that would be needed or take so long. But itâs a bug or malfunction in the antivirus/etc software â for whatever reason, it got confused into thinking it needed to be extra work.
Youâd need to identify all the antivirus and DLP and corporate monitoring tools that are installed, and try to narrow down specifically which of them are going awry, and report the issue to the respective support team for whichever software(s) are involved. Thereâs unfortunately nothing Cmder or ConEmu can do about this, because itâs happening externally from them.
Here are some questions / ideas / observations based on reviewing the WPA ETL I received from @dk40.
Later tonight, Iâll capture a similar trace on my machine where processes are fast within ConEmu, and compare the performance traces to look for similarities and differences. Hopefully that will reveal some things to explore further.
Does the speed improve if you temporarily turn off ESET?
ebehmoni.dll
andebehmonl.dll
are loaded into each process.ekrn.exe
(the ESET Kernel) is the largest consumer of CPU time, and it correlates with each process start. Thatâs to be expected, but I canât tell whether itâs interfering with the speed of execution.conemuhk.dll
into each process. Turning off ConEmuHk injection might also be able to improve the speed, especially if the slowness is coming from ESET.lsass.exe network operations
lsass.exe
during the trace. They roughly align with just after each of thecmd.exe
andfindstr.exe
etc processes starts. It almost looks as though some kind of authentication is happening that is correlated with starting processes.Does the speed improve if Cmder is installed in
C:\Cmder\
?%USERPROFILE%\Downloads\cmder_mini\
. The search indexer (and backup programs and other programs) watch for activity on files in the userâs Downloads and Documents directories and other user profile directories, and they may trigger additional work.d:\tmp\Cmder\
or%USERPROFILE%\Downloads\Cmder\
, but I donât have ESET installed.Something looks potentially surprising with SearchIndexer and/or Prefetch
cmd.exe-4a81b364.pf
andfindstr.exe-2e9c6fe2.pf
files, and a few other prefetch files.C:\Windows\Prefetch\
, but maybe thatâs expected and normal?Other observations
cmder_mini
, that each of them has been successfully Unblocked? I.e. that none of them show an âUnblockâ button in their individual File Properties dialogs.PnkBstrA.exe
) appears to be doing a heartbeat of network IO, roughly once per second.@Crayder As stated above something changed in Windows builds that caused a less than optimal
%cmder_root%\vendor\init.bat
to become ridiculously slow for a subset of users. We have been unable to determine the root cause.My code is not a fix it is a fundamental change in the way Cmder initializes
cmd.exe
sessions.It is for ALL Cmder users regardless of how long it takes to initialize! All users will see an improvement in first launch speeds and second launch speeds are even faster as shown by the screenshots above.
Latest build here
@andrej-dyck See below after some modifications, PR #2819, using Cmder Mini and User installed git with
/f
:Same here!
Right, Thanks. I checked for update within cmder but because it only checks for conemu updates, it fooled me into thinking I have up-to-date version of cmder too. Before writing down this comment I didnât know that right way to check cmder versions is to look into its folder and see the Version file. May be there is another way but I donât know about it.
That was the problem.
.19 had a bug that ran part of the git stuff in the foreground by accident.
Upgrading to .24 would solve the problem, because the fix was made between those versions.
In general, when an issue is encountered in a program, itâs handy to check if the latest version fixes it.
@chrisant996 @SMUsamaShah I am not certain the newest Cmder release includes background prompt refresh. Probably need to get a pre-rel!ase archive and try it.
With eset nod people were adding
cmd.exe
to solve the slowness. I doubt adding the cmder root folder will do much to speed things up.Edit: I do not recommend doing the above. Iâm just letting you know what others have done to temporarily work around overly aggressive DLP/Anti-Virus apps until they are fixed.
@daxgames Thatâs https://github.com/cmderdev/cmder/issues/2800, and itâs a bug in Cmder, not a Clink issue. I assume @DRSDavidSoft is busy and hasnât gotten around to fixing it.
@pmsobrado The âClink initialization has failedâ message is a bug in Cmder. Apart from looking unsightly, everything is actually fine. The Cmder script misinterprets Clinkâs response, mistakenly thinks Clinks failed when Clink is configured for autostart, and the Cmder script says a failure occurred, but actually everything is fine.
@pmsobrado you found another bug in this branch. Iâll fix that.
Same great result for me:
Iâve tried disabling ESET HIPs, and now it tooks me 0.16s to load! đ
Wow @WickedSilver is right, disabling HIPS fixed the issue for me as well. I assumed that pausing protection stopped everything ESET related, I guess not then.
I am too currently trying to figure out how to whitelist it. Adding the whole cmder folder as a hips exclusion doesnât seem to do the trick.
I can confirm that disabling HIPS (Host-based Intrusion Prevention System) in ESET fixed the slowness for me. Disabling HIPS does require a restart though. It might be best to add a rule to exclude cmder/conemu from ESET instead of disabling it altogether, but not sure how to do that at the moment.
Thanks for the reported observations @chrisant996!
No change. With Eset disabled, Ethernet disconnected and computer in Flight Mode, cmder start-up time is still 5s+, same as before
@deniscuculic,
I can run the Cmder init scripts in native Cmd.exe, VSCode Terminal, Tabby, Conemu, Windows Terminal, and Hyper.
Edit: Start All have relatively THE SAME speed results I mentioned above, less than 1 second, with full Cmder functionality. Even on an old underpowered VM on a laptop with a slow hdd. ConEmu is a bit slower by maybe .5-.75 second, so it is 1.x seconds on my VM. On my big fast workstation with NVMe SSD even ConEmu is .19 seconds. Edit: End
We are here to help, but we have done EVERYTHING we can since none of us are experiencing the problem and never have.
Instead of being so negative and trying to piss someone off, how about you tell us how it is performing for you?
Are you seeing extreme slowness reported above? Please provide launch times by adding
/t
to the task used to start Cmder as it provides the most accurate launch times.If so, can you provide the traces asked for above by @chrisant996 that might point to an issue we can not see?
@deniscuculic, as stated above several times, this is not a Cmder problem.
That being said, this thread contains links to an unreleased build that removes some inefficiency in the Cmder init process.
I am routinely seeing load times of .19 seconds. That is pretty fast.
Prior to this build I routinely saw launch times of 1.7-2.5 seconds.
The problem is that none of the Cmder developers can reproduce the problem to troubleshoot it adequately.
@andrej-dyck regarding these:
Did you turn off Windows Defender? I ask in case âturned off my antivirus softwareâ refers to AV software that you installed separately.
Do you mean OS autostart? Or do you mean CMD AutoRun? What does
clink autorun show
report? Hasclink autorun uninstall
been tried?Maybe this list of conclusions and questions will help:
Whatâs Known So Far
findstr
and piping their output.findstr
and the other invoked programs.Pending Questions
init.bat
script, or are similar commands slow after that, as well?init.bat
invocation in a session? What happens if youset CMDER_CONFIGURED=
and then runvendor\init.bat
again?init.bat
script from a plain oldcmd.exe
without using ConEmu?@usoliveira I am working on a way that is even faster for users who want to be in complete control and do not need all of Cmder ability to do auto configuration.
It is no good for the first time/inexperienced user but for someone seeing slowness due to some unknown external cause with full auto config it can be useful.
Users can control the config COMPLETELY using an optional hard coded script in
%cmder_root%\config
that still supports everything%cmder_root%\vendor\init.bat
does. If present%cmder_root%\vendor\init.bat
runs the optional script and exits skipping all the auto config that makes Cmder very flexible.I have seen load times of less than 1 second using the same VM in the PR.
Understood; no worries.
What it would record is a performance trace of all the APIs that are called by processes and the timings for them, so that they can be viewed/searched/analyzed in a timeline view (and other views). That would make it possible to identify specifically how the additional time is being spent.
P.S. I thought the WPR install can be customized to be smaller, but I donât remember for sure. And like you, I have a lot going on and Iâm not going to dig into that, specifically. đ
@daxgames @chrisant996 Some more information.
While I was writing an response, I started up Windows Sandbox, extracted cmder_mini, and it starts in 2sec.
However, notice the older Windows 10 version in the sandbox!
Furthermore, on my company notebook, which is managed, has an aggressive antivir and most of the same software, Cmder is quite quick (1-2sec). There, I have Windows 11 installed.
Can someone try downgrading to an older version of Cmder or ConEmu, and see if the problem goes away?
If downgrading ConEmu resolves the problem, then the issue is likely something in ConEmu, not Cmder.
If downgrading ConEmu doesnât resolve the problem, but downgrading Cmder resolves the problem, then there would be a possibility that the issue might be due to some recent change in the Cmder scripts.
Same. I extracted cmder.zip on a fresh install of Win10 22H2, and it takes up to 50sec to start.
Hi, Same here , it takes 20 or more seconds with /f and close to 60 without /f . Also tried adding variable of git location , this improves startup for few seconds.
Elapsed Time: 0:0:22.87 (22.87s total)
Microsoft Windows [Version 10.0.19045.2251] - Windows 10 Pro 22H2 cmder 1.3.20.151