This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 90267 - NetBeans IDE closes unexpectedly when a long line is printed into output window
Summary: NetBeans IDE closes unexpectedly when a long line is printed into output window
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Output Window (show other bugs)
Version: 5.x
Hardware: All Windows ME/2000
: P1 blocker (vote)
Assignee: t_h
URL: http://statistics.netbeans.org/analyt...
Keywords:
: 111296 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-29 11:20 UTC by minarikv
Modified: 2009-03-09 19:16 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample JSP file that closes the IDE (610 bytes, text/plain)
2006-11-29 11:22 UTC, minarikv
Details
stacktrace (2.14 KB, text/plain)
2007-10-08 14:54 UTC, amad3us
Details
stacktrace (2.14 KB, text/plain)
2007-10-17 21:13 UTC, jialu
Details
stacktrace (2.14 KB, text/plain)
2007-10-23 09:42 UTC, Rohan Ranade
Details

Note You need to log in before you can comment on or make changes to this bug.
Description minarikv 2006-11-29 11:20:15 UTC
Netbeans IDE closes unexpectedly if a long line is printed into output window.
For example, a line of about 6M characters sent from a JSP page as a single line
to the Tomcat's output window in IDE (via System.out.print) will close the IDE.

Tomcat does not exit, however, it has no console furthermore.
There is no additional information in Netbeans logs.

Background (why I need to print such a long line):
Originally, I found this problem when debugging a web-service client. A SOAP
message generated by Axis was printed to the application log (i.e. the output
window in Netbeans). Everything was okay up to the case when the client was
sending a large file (about 4MB), which was (according to WSDL) encoded into a
base64Binary element.
It is a problem of Axis that it generates such a long line in elements of
base64Binary type (without inserting line ends), but I still think Netbeans
should get over such a situation. At least, there should be some error message
window or a message in var/log/messages.
Comment 1 minarikv 2006-11-29 11:22:53 UTC
Created attachment 36358 [details]
Sample JSP file that closes the IDE
Comment 2 Milos Kleint 2006-11-30 11:01:37 UTC
a crash is usually a jdk issue, not of the application.
on my macosx, it doesn't crash but it hangs close to an halt. it doesn't
deadlock, but it seems to have a lot of problems displaying such a big line. I
tried both the line wrappign and non wrapping modes. 
the default textview mode hangs and doens't display the lines I think.
the wrapped view displays something but the repaints when moving the scrollbar
also hang the ide.


probably very hard to fix as the textcomponents in swing cannot probably handle
such a load.
Comment 3 Milos Kleint 2007-08-27 08:44:43 UTC
getting different output now: I get OOME exceptions now the IDE either recovers or stops responding. Seems to happen on
Jboss, while glassfish is ok. The glassfish server seems to put each print() on separate line and cuts the output to a
given number of lines.

java(14007,0x1b9b400) malloc: *** vm_allocate(size=2408448) failed (error code=3)
java(14007,0x1b9b400) malloc: *** error: can't allocate region
java(14007,0x1b9b400) malloc: *** set a breakpoint in szone_error to debug
INFO [null]: Failed to memory map output file for reading.  Trying to read it normally.
SEVERE [global]
java.io.IOException: Cannot allocate memory
	at sun.nio.ch.FileChannelImpl.map0(Native Method)
	at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:742)
[catch] at org.netbeans.core.output2.FileMapStorage.getReadBuffer(FileMapStorage.java:281)
	at org.netbeans.core.output2.AbstractLines.getText(AbstractLines.java:105)
	at org.netbeans.core.output2.OutputDocument.getText(OutputDocument.java:172)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1641)
	at org.netbeans.core.output2.OutputDocument.fireDocumentEvent(OutputDocument.java:488)
	at org.netbeans.core.output2.OutputDocument.access$200(OutputDocument.java:41)
	at org.netbeans.core.output2.OutputDocument$4.run(OutputDocument.java:415)
	at org.openide.util.Mutex.doEvent(Mutex.java:1181)
	at org.openide.util.Mutex.readAccess(Mutex.java:287)
	at org.netbeans.core.output2.OutputDocument.stateChanged(OutputDocument.java:412)
	at org.netbeans.core.output2.AbstractLines.run(AbstractLines.java:196)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
WARNING [null]: OOME while reading output.  Cleaning up.
java.lang.OutOfMemoryError
	at sun.misc.Unsafe.allocateMemory(Native Method)
	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
	at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:57)
	at sun.nio.ch.IOUtil.read(IOUtil.java:205)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:145)
	at org.netbeans.core.output2.FileMapStorage.getReadBuffer(FileMapStorage.java:293)
	at org.netbeans.core.output2.AbstractLines.getText(AbstractLines.java:105)
[catch] at org.netbeans.core.output2.OutputDocument.getText(OutputDocument.java:172)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1641)
	at org.netbeans.core.output2.OutputDocument.fireDocumentEvent(OutputDocument.java:488)
	at org.netbeans.core.output2.OutputDocument.access$200(OutputDocument.java:41)
	at org.netbeans.core.output2.OutputDocument$4.run(OutputDocument.java:415)
	at org.openide.util.Mutex.doEvent(Mutex.java:1181)
	at org.openide.util.Mutex.readAccess(Mutex.java:287)
	at org.netbeans.core.output2.OutputDocument.stateChanged(OutputDocument.java:412)
	at org.netbeans.core.output2.AbstractLines.run(AbstractLines.java:196)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



Comment 4 Milos Kleint 2007-08-28 10:09:25 UTC
more observations (build 070827):
the jboss nor glassfish support dont really print the output as one line, but spit each System.out.print(0 on separate line.
the same code in j2se project's main() method will print out one line only in the correct way. However it seems to wait
for the whole line to be processed and the scrolling is slow.. no OOME exception though..
Comment 5 Milos Kleint 2007-08-28 12:46:33 UTC
The issue only appears if the output window keeps on showing the end of the outputted text. If the user clicks into the
OW and lets the output finish and then scrolls over the data, nothing happens.


The problem is primarily in the way FileMapStorage.getReadBuffer() is implemented. Always just the end of file can be
mapped. As the file grows, new and new requests for memory mapping of sections not covered are coming in. There's no way
to explicitly get rid of old mapping (it will get GCed eventually), so the old ones stay around for a while. That's when
the OOME exception appears.

I don't have a solution off hand. It seems the whole idea of memory mapping needs to be discarded and eventually
replaced by something else.
Comment 6 Milos Kleint 2007-08-28 12:51:10 UTC
*** Issue 111296 has been marked as a duplicate of this issue. ***
Comment 7 amad3us 2007-10-08 14:54:09 UTC
Build: NetBeans IDE 6.0 Beta 1 (Build 200709141330)
VM: Java HotSpot(TM) Client VM, 1.5.0_12-b04
OS: Linux, 2.6.18-4-k7, i386

User Comments: 
Tomcat in debugging mode.
Logs of tomcat caused such an exception - to much logs or sth else.
Comment 8 amad3us 2007-10-08 14:54:13 UTC
Created attachment 50393 [details]
stacktrace
Comment 9 jialu 2007-10-17 21:13:38 UTC
Build: NetBeans IDE 6.0 Beta 1 (Build 200709141330)
VM: Java HotSpot(TM) Client VM, 1.5.0_12-b04
OS: Windows XP, 5.1, x86

User Comments: 
Comment 10 jialu 2007-10-17 21:13:55 UTC
Created attachment 51165 [details]
stacktrace
Comment 11 Rohan Ranade 2007-10-23 09:42:04 UTC
Build: NetBeans IDE 6.0 Beta 2 (Build 200710212201)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-b05
OS: Windows 2003, 5.2, x86

User Comments: 
Checking out NetBeans source code from NetBeans CVS repository
Comment 12 Rohan Ranade 2007-10-23 09:42:09 UTC
Created attachment 51466 [details]
stacktrace
Comment 13 Antonin Nebuzelsky 2008-02-07 15:52:47 UTC
Reassigning to new module owner Tomas Holy.
Comment 14 Exceptions Reporter 2008-03-19 16:55:15 UTC
This issue has already 50 duplicates 
Comment 15 Lukas Hasik 2008-03-20 10:43:53 UTC
te latest report is in 6.1 beta - http://statistics.netbeans.org/analytics/detail.do?id=35520

Tomasi, the issue has 50 duplicates, could you look at it. We do take issues with lot of duplicates seriously.  It might
happen that the priority will increase soon.
Comment 16 t_h 2008-03-31 15:21:11 UTC
Fixed:
http://hg.netbeans.org/core-main/rev/0ac7e3a5c5a9
or
http://hg.netbeans.org/main/rev/0ac7e3a5c5a9
There are also performance fixes for very long lines for both wrapped and unwrapped modes.
Comment 17 Exceptions Reporter 2008-08-20 23:51:51 UTC
This issue has already 100 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=85
Comment 18 Petr Chytil 2008-10-16 13:21:10 UTC
verified in:

Product Version: NetBeans IDE 6.5 RC1 (Build 200810151402)
Java: 1.5.0_16; Java HotSpot(TM) Client VM 1.5.0_16-133
System: Mac OS X version 10.5.5 running on i386; MacRoman; en_US (nb)
Userdir: /Users/petr/.netbeans/6.5rc1