Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328865 - A lot of console output will lead to OutOfMemoryError
Summary: A lot of console output will lead to OutOfMemoryError
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Buckminster (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: buckminster.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-27 13:33 EDT by Matthias Kappeller CLA
Modified: 2019-02-25 14:41 EST (History)
1 user (show)

See Also:


Attachments
This can help (but it's not as good as it should be) (2.48 KB, patch)
2010-10-27 13:38 EDT, Matthias Kappeller CLA
thomas: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Kappeller CLA 2010-10-27 13:33:25 EDT
(Eclipse 3.6.1)

When a launch configuration is started by buckminster (calling e.g. 'launch -l aLauncher.launch') and within a lot of output will be written to the console a OutOfMemoryError might crop up.

As I have tracked the problem down it seem that if the OutputStreamMonitor will never be flushed by anyone the internal StringBuffer will grow up to any size. And it looks like this will happen e.g. in a Hudson environment.

So if the StringBuffer will get too large the OutputStreamMonitor needs to be flushed (calling org.eclipse.debug.internal.core.OutputStreamMonitor.flushContents())

Exception in thread "Output Stream Monitor" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2882)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
    at java.lang.StringBuffer.append(StringBuffer.java:224)
    at org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:154)
    at org.eclipse.debug.internal.core.OutputStreamMonitor.access$1(OutputStreamMonitor.java:134)
    at org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:207)
    at java.lang.Thread.run(Thread.java:619)
Comment 1 Matthias Kappeller CLA 2010-10-27 13:38:46 EDT
Created attachment 181854 [details]
This can help (but it's not as good as it should be)

In our environment this patch has solved the problem.
But it's not as good as I'll like it to be.

The StreamMonitor has to be flushed at the right time. But when is it?
In this patch the stream will be flushed every time a text will be appended. I think this is too often!

Does someone have a better idea? Please...
Comment 2 Thomas Hallgren CLA 2011-01-26 16:04:25 EST
I think this fix is OK. We don't care about the string that is built up in the StreamMonitor anyway so it doesn't matter that it is truncated often.

I have applied the patch to helios-maintenance, rev 11655.

Thanks.