eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
81 stars 184 forks source link

Slow console with word wrap #1298

Open frankbenoit opened 1 year ago

frankbenoit commented 1 year ago

Since 2023-06, and still with 2023-09 I experience a deadlock of the Eclipse IDE when I run a JUnit test on project level.

Steps to reproduces:

  1. Have the console view with "word wrap" active
  2. Have the Eclipse IDE started freshly with the console view not opened, e.g. as a view tab that is not the top most.
  3. The project I run, does have ArchUnit tests that do create console output, even before the first test starts, in the class loading Right-click on the project, "Run as .." "JUnit test Alt-Shift X, T"

The status bar shows "Starting ...", the UI freezes and never comes back.

With "YourKit" I detected this potential dead lock, because this thread is locked for more than 10 seconds:

jdk.internal.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:378)
org.eclipse.ui.internal.console.IOConsolePartitioner.offer(IOConsolePartitioner.java:712)
org.eclipse.ui.internal.console.IOConsolePartitioner.streamAppended(IOConsolePartitioner.java:695)
org.eclipse.ui.console.IOConsoleOutputStream.notifyParitioner(IOConsoleOutputStream.java:281)
org.eclipse.ui.console.IOConsoleOutputStream.encodedWrite(IOConsoleOutputStream.java:276)
org.eclipse.ui.console.IOConsoleOutputStream.write(IOConsoleOutputStream.java:260)
org.eclipse.debug.internal.ui.views.console.ProcessConsole$StreamListener.streamAppended(ProcessConsole.java:809)
org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:171)
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
org.eclipse.debug.internal.core.OutputStreamMonitor.fireStreamAppended(OutputStreamMonitor.java:168)
org.eclipse.debug.internal.core.OutputStreamMonitor.internalRead(OutputStreamMonitor.java:256)
org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:225)
org.eclipse.debug.internal.core.OutputStreamMonitor$$Lambda$1604.0x0000000801fef830.run()
java.lang.Thread.run(Thread.java:833)

Now, when I open the "Console" view first, I can avoid the deadlock.

iloveeclipse commented 1 year ago

Please if Eclipse hangs, run jstack and attach generated thread dump here.

frankbenoit commented 1 year ago

threads.txt

iloveeclipse commented 1 year ago

threads.txt

This doesn't show a deadlock. I guess the output is very specific, either too long lines or something SWT can't render fast enough.

frankbenoit commented 1 year ago

The console output of the completed test does have 22000 log lines. In the beginning there are 3 lines that are very long with 31724 characters each. Here ArchUnit lists the class-path with all found jar files.

frankbenoit commented 1 year ago

.. and "word wrap" button was pressed. (perhaps relevant)

iloveeclipse commented 1 year ago

.. and "word wrap" button was pressed. (perhaps relevant)

That is it. World wrap is not working well with lot of output.

frankbenoit commented 1 year ago

Hm, for me it is fine now, I know how to workaround now. Perhaps this issue can be closed. But a hard lesson for everyone coming into the same situation.

VS Code solves this by showing the first 1000 chars, then a tag "Show more (21KB)". When pressing it, it shows raw text only and switches off enhanced capabilities for performance reasons.

frankbenoit commented 1 year ago

So there is a potential logic bug ... When the console view is having word-wrap AND is initially not visible AND a first output with long lines is pushed, then it makes the IDE to freeze forever. If it is initially visible OR does not have word-wrap, it works well.

jukzi commented 11 months ago

word wrap is disabled by default and also the buffer is very limited by default. If you change that you need to live with it or propose a performance improvement patch