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 256182 - OutOfMemoryError: Requested array size exceeds VM limit
Summary: OutOfMemoryError: Requested array size exceeds VM limit
Status: RESOLVED INVALID
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-26 14:09 UTC by geegog
Modified: 2015-11-11 20:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 220777


Attachments
stacktrace (1.03 KB, text/plain)
2015-10-26 14:09 UTC, geegog
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geegog 2015-10-26 14:09:56 UTC
Build: NetBeans IDE 8.0.2 (Build 201411181905)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.45-b02, Java(TM) SE Runtime Environment, 1.8.0_45-b15
OS: Windows 7

User Comments:
geegog: OutOfMemoryError: Requested array size exceeds VM limit




Stacktrace: 
java.lang.OutOfMemoryError: Requested array size exceeds VM limit
   at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
   at java.lang.StringBuilder.<init>(StringBuilder.java:101)
   at org.h2.value.Transfer.readString(Transfer.java:246)
   at org.h2.engine.SessionRemote.done(SessionRemote.java:617)
   at org.h2.command.CommandRemote.prepare(CommandRemote.java:68)
   at org.h2.command.CommandRemote.prepareIfRequired(CommandRemote.java:104)
Comment 1 geegog 2015-10-26 14:09:58 UTC
Created attachment 156976 [details]
stacktrace
Comment 2 matthias42 2015-10-26 20:26:27 UTC
Please provide some more information:

- what did you do when this error occured
- it looks like you executed an SQL statement, can you give
  - the statement
  - the table definitions
  - the approximate expected resultset size?
- Please check the connection properties (what is the state of "use scrollable cursors"?)
- what version of h2 do you use?
- What is stored in the DB?

The message is suspicious (cite from Oracle Hotspot troubleshooting guide https://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-VM/html/memleaks.html#gbyvi):

-------------
3.1.3 Detail Message: Requested array size exceeds VM limit

The detail message Requested array size exceeds VM limit indicates that the application (or APIs used by that application) attempted to allocate an array that is larger than the heap size. For example, if an application attempts to allocate an array of 512MB but the maximum heap size is 256MB then OutOfMemoryError will be thrown with the reason Requested array size exceeds VM limit. In most cases the problem is either a configuration issue (heap size too small), or a bug that results in an application attempting to create a huge array, for example, when the number of elements in the array are computed using an algorithm that computes an incorrect size.
-------------


Taking a look at the source code from h2 it looks like a broken network stream:

http://grepcode.com/file/repo1.maven.org/maven2/com.h2database/h2/1.4.187/org/h2/engine/SessionRemote.java?av=f

Line 617 starts to read an error string from network:

http://grepcode.com/file/repo1.maven.org/maven2/com.h2database/h2/1.4.187/org/h2/value/Transfer.java#Transfer.readString%28%29

Line 242 reads the size of the string from the stream and creates a StringBuilder from it (line 246). This is basicly a denial of service attack the server can cause on the client.

Without further knowledge I'd raise a bug report with the h2 developers.
Comment 3 matthias42 2015-11-11 20:50:21 UTC
No further reply. I filed a bug report against h2:

https://github.com/h2database/h2database/issues/205

and close it here, as calling side (netbeans) can't prevent this.