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 142645 - [65cat] OutOfMemoryError: Java heap space
Summary: [65cat] OutOfMemoryError: Java heap space
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: John Baker
URL: http://statistics.netbeans.org/except...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2008-08-01 20:47 UTC by sunbiz
Modified: 2014-07-31 07:13 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 85427


Attachments
stacktrace (2.51 KB, text/plain)
2008-08-01 20:47 UTC, sunbiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2008-08-01 20:47:26 UTC
Build: NetBeans IDE Dev (Build 080731)
VM: Java HotSpot(TM) Client VM, 11.0-b12, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b25
OS: Windows Vista, 6.0, x86

User Comments: 
Running a long query from the query designer causes this exception

Stacktrace: 
java.lang.OutOfMemoryError: Java heap space
        at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1421)
        at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2708)
        at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:459)
        at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2411)
        at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1657)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2036)
Comment 1 sunbiz 2008-08-01 20:47:34 UTC
Created attachment 66350 [details]
stacktrace
Comment 2 sunbiz 2008-08-01 20:57:19 UTC
One sure and easy way to reproduce this bug:
1.) Create the sakila demo MySQL database: http://dev.mysql.com/doc/sakila/en/sakila.html
2.) Open query designer
3.) drop any tables say: actor, film, film_actor and language
4.) Also add address which is not a related table
5.) Run the generated query. This causes an OutOfMemoryException after trying for sometime to get data for the query.
Comment 3 David Vancouvering 2008-08-01 21:15:10 UTC
I ran into this elsewhere (in the SQL Editor I think).  The problem is that the MySQL JDBC driver by default fetches
*all* the rows from the database, and will happily run out of memory if the result set is large enough. 
Statement.setFetchSize() has no effect.

I think as of MySQL 5.0 Statement.setFetchSize() works to throttle the number of rows fetched at a time.

For more information see http://forums.mysql.com/read.php?39,137457,146876#msg-146876 and
http://bugs.mysql.com/bug.php?id=8779.

John, you can also contact Mark Matthews directly if need be.

However, this doesn't solve things for the application code.  The application writer working with a query that returns a
lot of results will need to set fetch size in their code explicitly or risk running out of memory.
Comment 4 John Baker 2008-08-01 23:57:01 UTC
David if you have an SQL script that inserts lots of rows, could you email it to me or attach it if it's not too large.
 Thanks
Comment 5 David Vancouvering 2008-08-04 23:02:53 UTC
I don't think I have such a script any more.  What I did was write a JDBC program that inserts 100 rows in a batch and
then just run it N times until you get enough data.  We should probably put such a script on the Wiki once it's working,
as this seems to come up pretty regularly.

David
Comment 6 David Vancouvering 2008-08-15 20:35:38 UTC
John, can you please evaluate this issue.  Do you plan to fix it in 6.5?  The Sakila plugin should give you what you
need to reproduce.
Comment 7 David Vancouvering 2008-09-24 19:52:59 UTC
We were not able to get to these issues before code freeze - changing target
milestone to 'future'
Comment 8 Petr Blaha 2008-11-18 13:09:05 UTC
Move visualsqleditor subcomponents below visualweb