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 187653 - OOM when entities from db are generated
Summary: OOM when entities from db are generated
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.0
Hardware: PC All
: P1 normal (vote)
Assignee: Sergey Petrov
: 188311 (view as bug list)
Depends on:
Blocks: 178108 181861
  Show dependency tree
Reported: 2010-06-16 12:44 UTC by Sergey Petrov
Modified: 2010-11-15 16:06 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

schema (1.53 MB, text/xml)
2010-06-16 12:46 UTC, Sergey Petrov
exception log (3.59 KB, text/plain)
2010-06-16 12:48 UTC, Sergey Petrov

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Petrov 2010-06-16 12:44:09 UTC
reproducible with 100615,
ubuntu 10.04 32bit
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing) 

1.5 Gb system memory

start 6.9 ide 
start dev ide from 6.9 (may be with less system memory can be reproduced without .9)
create j2se project
create all entities from derby db I have(schema will be attached)

progress is slowed and finally oom is logged in output
Comment 1 Sergey Petrov 2010-06-16 12:46:01 UTC
Created attachment 100129 [details]
Comment 2 Sergey Petrov 2010-06-16 12:48:37 UTC
Created attachment 100130 [details]
exception log
Comment 3 Tomas Zezula 2010-06-16 15:02:02 UTC
We analyzed the heap dumps with Tomas Hurka and found that there are unreferenced objects from eclipse link which are not freed and the classes are not unloaded. There was only single reference to them from j.l.ref.Finalizer.unfinalized which is very strange (there were not in the reference queue).
We sent  the dump to JVM team to help us.
Comment 4 Tomas Zezula 2010-06-16 15:04:39 UTC
I've integrated an URLClassLoader cache which improves the speed of generation of entity classes and also decreases a load of the PermGen.
jet-main 46c9541b5ae8
Comment 5 Quality Engineering 2010-06-17 03:20:16 UTC
Integrated into 'main-golden', will be available in build *201006170001* on (upload may still be in progress)
User: Tomas Zezula <>
Log: #187653:OOM when entities from db are generated - cache
Comment 6 Sergey Petrov 2010-06-17 07:49:13 UTC
it looks like the fix make it better/faster, but I see next output

WARNING []: Not enough memory to compile folder: /tmp/WebApplication1/src/java

if try to regenerate entities in web project(have ap in editor enabled by default)
Comment 7 Tomas Zezula 2010-06-17 21:01:41 UTC
Finally I was able to create a standalone test case showing the problem. Honza L. has sent it to JVM team. When evaluated I will add more info.
Comment 8 Petr Jiricka 2010-06-29 23:06:20 UTC
Hi, any update on this issue? Dafe just completed the fix for bug 181861 (JPA metamodel generation in Maven), and this bug is the last problem preventing the integration of both 178108 and 181861 into 6.9.1.

I am thinking what is the workaround. It sounds like the workaround should be to disable annotation processors in the editor for this project, and turn off compile (deploy) on save, is that correct? Or is this problem still there after these steps?
Comment 9 Tomas Zezula 2010-06-30 08:29:43 UTC
Sorry, no response yet.
Comment 10 Sergey Petrov 2010-07-01 14:43:01 UTC
Tomas, can some api be added to disable/enable ap processing?
It may be useful to workaround the issue and also help with any case with a lot of classes generation to avoid processing after each class addition and after classes modifications (like first create base entity, then add content, it's likely current realization process first one and then second).
Comment 11 Tomas Zezula 2010-07-01 19:41:27 UTC
There is already a possibility how to turn off APs.
The AnnotationProcessingQuery.Result has a method annotationProcessingEnabled() which returns a Set{ON_SCAN,IN_EDITOR}. When empty no APs will be run. The result of the method is controlled by the project properties (for j2seproject annotation.processing.enabled,
But if you disable ON_SCAN the Compile On Save will not work :-(
Comment 12 Sergey Petrov 2010-07-01 20:02:44 UTC
From project properties I can set corresponding properties to false(temporary for generation "transaction"). But It will require additional persistence PersistenceAnnotationSupportProvider (or similar) to be added and called from persistence code. In my sugession I'm asking about something like AnnotationProcessingQuery::enable() and AnnotationProcessingQuery::disable() if possible as I know I can access AnnotationProcessingQuery from base ide from project lookup.
Comment 13 Tomas Zezula 2010-07-07 12:58:26 UTC
Adding AnnotationProcessingQuery::enable() and AnnotationProcessingQuery::disable() may be dangerous as anyone may turn off the AP and destroy the CoS.
Comment 14 Jan Lahoda 2010-08-16 09:00:07 UTC
*** Bug 188311 has been marked as a duplicate of this bug. ***
Comment 15 Tomas Zezula 2010-08-23 15:31:19 UTC
Depends on the patch in eclipse link.
Comment 16 Sergey Petrov 2010-08-31 09:38:08 UTC
a bit better in 2.2 now, also it's easy to remove eclipselink ap registration now without switch off ap processing completely.
Comment 17 Petr Jiricka 2010-09-29 08:49:02 UTC
FYI, the bug on the EL side is
Comment 18 Quality Engineering 2010-10-19 02:58:47 UTC
Integrated into 'main-golden', will be available in build *201010190000* on (upload may still be in progress)
User: Sergey B. Petrov <>
Log: fix #187653 - part to fix in web project (workaround on eclipselink+nb side), works with newer eclipselink library only
Comment 19 Sergey Petrov 2010-10-19 15:18:34 UTC
Changes for supported ant projects are submitted, need to update el library when will be available.
Right now have no ideas what to do with maven support as it's likely do not use same properties for ap.
Comment 20 Sergey Petrov 2010-10-27 11:22:48 UTC;node=7aba89a5a4ca  part for all supported ant projects.

Jesse, can you give a hint how to add ap parameters used by scanning/parsing to maven projects?
Comment 21 Jesse Glick 2010-10-27 12:25:06 UTC
(In reply to comment #20)
> how to add ap parameters used by scanning/parsing to maven projects?

You should start by defining the appropriate parameters to maven-compiler-plugin in the POM. Then file an RFE in projects/maven blocking bug #184952 for MavenAnnotationProcessingQueryImpl to interpret them.
Comment 22 Petr Jiricka 2010-11-10 12:28:26 UTC
> need to update el library when will be available.

Sergey just did this yesterday:
So only now the bug is fully fixed for Ant.
Comment 23 Petr Jiricka 2010-11-10 12:50:09 UTC
Hi Sergey, could you please update the EclipseLink library also in the beta branch? Thanks.
Comment 24 Sergey Petrov 2010-11-10 14:43:04 UTC if I got it right still operates with clones, do we have similar FAQ for releases as branches?
Comment 25 Petr Jiricka 2010-11-10 17:55:14 UTC
Transplanted to the beta branch:
Comment 26 Quality Engineering 2010-11-11 06:09:54 UTC
Integrated into 'main-golden', will be available in build *201011110000* on (upload may still be in progress)
User: Sergey B. Petrov <>
Log: fix #187653 eclipselink 2.2.0 m4
Comment 27 Sergey Petrov 2010-11-15 16:06:20 UTC
let's have separate issue for maven projects as it's another internally and require separate fix.

Petr, shoould it be P2?