Skip to content

Trim console output before processing it in console document#2462

Open
trancexpress wants to merge 1 commit intoeclipse-platform:masterfrom
trancexpress:gh2283
Open

Trim console output before processing it in console document#2462
trancexpress wants to merge 1 commit intoeclipse-platform:masterfrom
trancexpress:gh2283

Conversation

@trancexpress
Copy link
Contributor

When processing large amounts of console output of a process, its possible that the Eclipse UI will freeze.
E.g. on Linux, very long lines (> 1 million symbols) result in such freezes.

Using the console limit preference doesn't help preventing this freeze, despite limitting the contents seen in the console.

This change adjusts IOConsolePartitioner.QueueProcessingJob.processPendingPartitions() to trim pending console output before setting this output in the console document, if a console limit is set in the Eclipse preferences.

See: #2283

applyStreamOutput(pendingCopy, sizeHint);
}
checkFinished();
checkBufferSize(); // needs partitions synchronized
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper trimming is done here. The above change just reduces the output that will be processed by the document / underlying widget.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent Eclipse UI freezes when processing extremely large console output by trimming pending console output in IOConsolePartitioner.QueueProcessingJob.processPendingPartitions() before applying it to the console document, when a console limit (water marks) is configured.

Changes:

  • Adds logic in processPendingPartitions() to trim pending partitions based on the console highWaterMark before calling applyStreamOutput(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

Test Results

 1 980 files  ±0   1 980 suites  ±0   1h 34m 51s ⏱️ + 4m 15s
 4 750 tests ±0   4 726 ✅ ±0   24 💤 ±0  0 ❌ ±0 
14 250 runs  ±0  14 068 ✅ ±0  182 💤 ±0  0 ❌ ±0 

Results for commit 683a8a7. ± Comparison against base commit d420ea8.

♻️ This comment has been updated with latest results.

@trancexpress
Copy link
Contributor Author

Fails on Linux:

 org.eclipse.debug.tests.console.IOConsoleTests.testTrim -- Time elapsed: 0.180 s <<< FAILURE!
org.opentest4j.AssertionFailedError: 
Expected string not found in console document. ==> expected: <0123456789> but was: <
012345678>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
	at org.eclipse.debug.tests.console.IOConsoleTestUtil.verifyContentByOffset(IOConsoleTestUtil.java:572)
	at org.eclipse.debug.tests.console.IOConsoleTests.testTrim(IOConsoleTests.java:718)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
 org.eclipse.debug.tests.console.IOConsoleFixedWidthTests.testTrim -- Time elapsed: 0.233 s <<< FAILURE!
org.opentest4j.AssertionFailedError: 
Expected string not found in console document. ==> expected: <0123456789> but was: <
012345678>
	at org.eclipse.debug.tests.console.IOConsoleTestUtil.verifyContentByOffset(IOConsoleTestUtil.java:572)
	at org.eclipse.debug.tests.console.IOConsoleTests.testTrim(IOConsoleTests.java:718)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
 org.eclipse.debug.tests.console.ProcessConsoleManagerTests.testProcessConsoleLifecycle(TestInfo) -- Time elapsed: 0.084 s <<< FAILURE!
java.lang.AssertionError: 
[console has been added] 
Expected size: 1 but was: 3 in:
[org.eclipse.ui.console.IOConsole@2548368f,
    org.eclipse.ui.console.IOConsole@2a858f05,
    org.eclipse.debug.internal.ui.views.console.ProcessConsole@3946284c]
	at org.eclipse.debug.tests.console.ProcessConsoleManagerTests.testProcessConsoleLifecycle(ProcessConsoleManagerTests.java:88)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

@trancexpress
Copy link
Contributor Author

Lets apply this one in a separate issue, its causing fails:

@@ -1203,6 +1240,8 @@ public class IOConsolePartitioner
                                        if (truncateToOffsetLineStart) {
                                                int cutoffLine = document.getLineOfOffset(truncateOffset);
                                                cutOffset = document.getLineOffset(cutoffLine);
+                                               // deal with case of one long line
+                                               cutOffset = Math.max(cutOffset, truncateOffset);
                                        }
                                        if (cutOffset >= length) {
                                                updateType = DocUpdateType.TRIM;

@trancexpress trancexpress marked this pull request as ready for review February 24, 2026 15:22
@trancexpress
Copy link
Contributor Author

Fail on Linux is:

 org.eclipse.core.tests.resources.NatureTest.testBug297871 -- Time elapsed: 0.006 s <<< ERROR!
java.nio.file.FileAlreadyExistsException: /home/runner/work/eclipse.platform/eclipse.platform/resources/tests/org.eclipse.core.tests.resources/target/work/data/40050a949511001114069a35697b81a0/.project
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystem.copyFile(UnixFileSystem.java:668)
	at java.base/sun.nio.fs.UnixFileSystem.copy(UnixFileSystem.java:1075)
	at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:300)
	at java.base/java.nio.file.Files.copy(Files.java:1305)
	at org.eclipse.core.tests.resources.NatureTest.testBug297871(NatureTest.java:303)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

@trancexpress trancexpress changed the title Trim console output before processing it console document Trim console output before processing it in console document Feb 27, 2026
@trancexpress trancexpress force-pushed the gh2283 branch 3 times, most recently from d7abd9c to 5c2fefa Compare March 2, 2026 17:05
@trancexpress
Copy link
Contributor Author

@iloveeclipse please check this one as well, it should solve the console UI freezes if the console limit is set (together with the line trim PR which you merged).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

When processing large amounts of console output of a process, its possible that the Eclipse UI will freeze.
E.g. on Linux, very long lines (> 1 million symbols) result in such freezes.

Using the console limit preference doesn't help preventing this freeze, despite limitting the contents seen in the console.

This change adjusts IOConsolePartitioner.QueueProcessingJob.processPendingPartitions()
to trim pending console output before setting this output in the console document, if a console limit is set in the Eclipse preferences.

See: eclipse-platform#2283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants