spring-attic / spring-ide

Spring Development Environment for Eclipse
299 stars 126 forks source link

STS hangs and uses 100% CPU when console is open with ANSI console enabled and dark theme #306

Open andrijaantunovic opened 6 years ago

andrijaantunovic commented 6 years ago

When using the dark theme in STS and having console open, the IDE starts to hang and becomes unresponsive, and uses up the entire CPU core. This happens regardless if any app is running, as long as there is enough text in the console.

Switching away from the console tab, closing or clearing the console makes the IDE work normally, but as soon as there is more than ~10 lines in the console it becomes unresponsive again.

Disabling the ANSI console resolves the hang problem, but the console output becomes ugly and hard to read with plenty of mojibake wherever there's supposed to be a color change.

The issue seems to be between the dark theme and ANSI console, perhaps they are clashing by each trying to set the console's color in a loop? However, the issue is reported here and the developer of ansi-econsole suggests that it may be an issue with STS because he can't reproduce it in vanilla Eclipse with either theme.

Version info: Spring Tool Suite 3.9.5.201807031753-RELEASE-e48 org.springsource.sts.ide Ansi Console 1.3.3.201605090119 net.mihai-nita.ansicon.feature.group

martinlippert commented 6 years ago

I tried an STS 3.9.5 release build and I am not running into this problem... :-( However, I am on macOS, so that might behave differently here, since your original report tells me you are on Windows, right? Would be good to know if updating the JDK helps here.

Can you also take a few thread dumps while STS hangs or is unresponsive (using jps and jstack) and attach them here? That might help to reveal what is going wrong here.

andrijaantunovic commented 6 years ago

Yes, I'm on Windows 10. JDK version is 1.8.0_181.

Here's the result of jstack while the IDE hangs when I try to scroll through the console:

javadump.txt

martinlippert commented 5 years ago

From looking at the thread dump (thanks for that), it looks like the Spring-specific tooling it not involved here, but it is running swt-related platform code here. Hard to say what the underlying problem really is. Is this problem still there on your machine and happens every time you do this? Even when using the latest STS 3.9.6 release on Eclipse 2018-09? If so, I think we should also report this to the Eclipse SWT platform project, would be good to hear from them what they think. But can you double check using the latest version again?

kunlan commented 5 years ago

I have a similar problem, when I use the dark theme, clicking on the console panel will not respond. Classic themes and light themes not.

martinlippert commented 5 years ago

@kunlan can you provide a few more details? Operating system/version, STS version, and JDK version would be useful, also a thread dump while STS hangs, if possible, could reveal more details.

martinlippert commented 5 years ago

Another option here would be to uninstall the ANSI coloring plugin. That way you would loose the coloring in the console output though.

But if you disable the console coloring when starting the Spring app, you won't get the ANSI color codes in the console output.

zack10 commented 4 years ago

I am using STS version 4.4.2.RELEASE and still getting the same problem when I use dark theme, every time the console is launched STS starts freezing, but when I switch to light theme the problem disappears, is this bug still unsolved I noticed it's been open since Aug 2018?

kdvolder commented 4 years ago

@zack10 I just tried to run a boot app in STS 4.4.2 using Dark theme and experienced no problems. I am on Linux though. Could be this issue is specific to Windows only.

Let me try if it works fine in my Windows VM.

zack10 commented 4 years ago

@kdvolder maybe it's specific to windows. I'm using Windows 10 and every time I tried to run my project on dark them STS crushes and stops responding

kdvolder commented 4 years ago

First I thought it was working fine for me in Windows VM as well. But then after playing around a bit the STS window became unresponsive. I'm trying now if disabling ansi console helps at all.

kdvolder commented 4 years ago

After disabling the ansi console from preference (i.e go to "Window >> Preferences >> Ansi Console" then uncheck the 'enabled' box). The problem appears to be resolved. So I think this is a problem with the Ansi Console somehow.

So I think the problem should be raised here:

https://github.com/mihnita/ansi-econsole/issues

zack10 commented 4 years ago

Yes that's the problem I did the same thing and disabled Ansi Console and the problem stopped occurring, but the console, on the other hand, looks a bit weird the colors really help differentiating between error, warning and info logs especially with long console logs. thanks @kdvolder hope this bug gets solved soon.

kdvolder commented 4 years ago

@zack10 I don't think its our bug to fix as this seems to be a problem with the Ansi Console plugin.

We really should have alerted it's maintainer/owner of the problem when it was first discovered in 2018. I have done that now here:

https://github.com/mihnita/ansi-econsole/issues/43

kdvolder commented 4 years ago

but the console, on the other hand, looks a bit weird the colors really help differentiating between error, warning and info logs especially with long console logs

Yes, the ansi console is a nice feature, we like it too, which why we include it in our distribution :-). Unfortunately for the time being I really don't have better advice than either:

zack10 commented 4 years ago

Yes exactly. I switched to light theme, and it works great, thanks @kdvolder I hope the maintainers of Ansi Console plugin will fix the bug in the next update :)

andrijaantunovic commented 4 years ago

@zack10 We really should have alerted it's maintainer/owner of the problem when it was first discovered in 2018. I have done that now here: mihnita/ansi-econsole#43

There's actually a bug report from 2017 for this issue: https://github.com/mihnita/ansi-econsole/issues/27

I've linked to it in my OP, but there was no confirmation if it actually has to do with ansi-econsole or STS. Since then, the ansi-econsole maintainer has managed to identify the cause somewhat, but doesn't have a solution yet.