Excessive CPU usage and associated lag
Bug report
- iTerm2 version: Build 3.6.1
- OS version: 26.0 (25A354)
- com.googlecode.iterm2.plist
- Screenshot showing that iTerm2 has used nearly 10 hours of CPU time after 6 days of uptime:
Detailed steps to reproduce the problem
- No obvious way to reproduce that I could have figured out so far (unfortunately)
What happened
iTerm2 got really laggy. The issue appeared as if a SSH connection was having packet loss or working over slow Wi-Fi (and this is what I suspected at first). Entering text would have a delay of probably about 0.2-0.5 seconds or so - it was really noticeable and annoying. Entering longer text snippets would have the characters appear in bursts.
However, the lag persisted even on local connections over local LAN. Finally, I noticed the excessive iTerm2 CPU time usage. iTerm2 wasn't busy-looping, and the CPU time was modest while the app was idle. As soon as I tried to type some text, the CPU load would spike to ~100%. As we can see from the screenshot, iTerm2 had managed to rack up over 10 hours of CPU time over 6 days.
Quitting iTerm2 and restarting it remedied the issue, and key presses are again processed in a snappy fashion. I will be sure to keep track of this to see if this is some issue that arises over time. Maybe there's some leak or similar that results in some data structure growing excessively large over time and thus leading to the CPU load.
I should have tried to get some kind of spindump to see where it was spending the CPU time -- but it's too late now. If I get iTerm2 into a similar state again, I'm sure to try to get the dump.
What should have happened
iTerm2 to not spend 10 hours of CPU over 6 days uptime.
