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 85179 - PermGen Space OutOfMemory Error
Summary: PermGen Space OutOfMemory Error
Status: VERIFIED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: BPEL Project (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Mikhail Kondratyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-18 22:57 UTC by hemant_bedekar
Modified: 2007-05-31 14:27 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the log file from \Alaska\userdir\var\log (50.35 KB, application/octet-stream)
2006-09-21 20:33 UTC, hemant_bedekar
Details
error log (86.10 KB, application/octet-stream)
2006-09-21 22:31 UTC, hemant_bedekar
Details
each step is a new clean/build of the synch sample bpel project (27.89 KB, application/octet-stream)
2006-09-26 17:06 UTC, Tientien Li
Details
log file from 09/28/2006 at 1130 (125.71 KB, application/octet-stream)
2006-09-29 01:31 UTC, hemant_bedekar
Details
from 09/28/2006 at 1340 (31.86 KB, application/octet-stream)
2006-09-29 01:32 UTC, hemant_bedekar
Details
weak reference creating ActiveQueue (1.20 MB, image/gif)
2006-09-30 05:22 UTC, Sreenivasan Genipudi
Details
MetaInfServices.Lookup() creating activequeue (905.69 KB, image/gif)
2006-09-30 05:23 UTC, Sreenivasan Genipudi
Details
Screenshot (46.75 KB, image/png)
2007-05-31 14:27 UTC, Victoria Zhukovskaya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hemant_bedekar 2006-09-18 22:57:18 UTC
PermGen Space OutOfMemory Error is seen in NetBeans log file. I havent been able
to consistently reproduce this issue, but I have run into this issue several
times with several different builds.

Keith Babo and Suresh Potiny are aware of the issue and could be contacted for
additional information.
Comment 1 Michael Frisino 2006-09-19 19:58:13 UTC
can't really work on this without more detail.

assigning to venkat to resolve with bug filer since both are in monrovia.
Comment 2 hemant_bedekar 2006-09-21 01:08:18 UTC
We dont have too much information to provide other than that we see this error
periodically.

Keith suggested I use JDK1.6 so we could get some diagnostic information - but I
havent been able to successfully build and deploy my projects when using JDK1.6.
Discussion is ongoing.
Comment 3 hemant_bedekar 2006-09-21 20:33:07 UTC
I ran into the PermGen Space OutOfMemoryError in NetBeans while building my Comp
App project. log file is attached.
Comment 4 hemant_bedekar 2006-09-21 20:33:58 UTC
Created attachment 34337 [details]
the log file from \Alaska\userdir\var\log
Comment 5 hemant_bedekar 2006-09-21 22:31:08 UTC
Ran into the issue again while validating a BPEL File. Log file is attached
(messages.log_09212006_1430_validating_BPEL)
Comment 6 hemant_bedekar 2006-09-21 22:31:33 UTC
Created attachment 34347 [details]
error log
Comment 7 hemant_bedekar 2006-09-22 01:09:33 UTC
Using JDK's JVM Heap Dump option, I was able to get two memory dumps - Please
note that I did *not* get these when the Permgen Space OutOfMemory Error was
thrown. In fact I am not aware when these were created.  
I have attached the dumps for analysis (the attachments are big - ~ 15 Mb)
Comment 8 Tientien Li 2006-09-25 23:15:37 UTC
Hemant,

Can you attach the project that caused this problem?

Thanks,

--
Tientien Li
Comment 9 Tientien Li 2006-09-26 16:21:28 UTC
OK, found a possible cause of this problem. The bpel project build ant task 
uses a special class loader which is not released after the build. So after 
repeating about 20 clean/build of the synch sample bpel project. I was able to 
reproduce the PermGen out of memory error:

*********** Exception occurred ************ at 8:13 AM on Sep 26, 2006
java.lang.OutOfMemoryError: PermGen space
*********** Exception occurred ************ at 8:14 AM on Sep 26, 2006
java.lang.OutOfMemoryError: PermGen space
*********** Exception occurred ************ at 8:14 AM on Sep 26, 2006
java.lang.OutOfMemoryError: PermGen space class loader which is not released 
after build.

Reassigned this ticket to Sreeni..
Comment 10 Tientien Li 2006-09-26 17:06:59 UTC
Created attachment 34523 [details]
each step is a new clean/build of the synch sample bpel project
Comment 11 hemant_bedekar 2006-09-29 01:24:02 UTC
Ran into this issue twice today - I am attaching the message log file and the
associated Memory Dump
Comment 12 hemant_bedekar 2006-09-29 01:31:36 UTC
Created attachment 34684 [details]
log file from 09/28/2006 at 1130
Comment 13 hemant_bedekar 2006-09-29 01:32:02 UTC
Created attachment 34685 [details]
from 09/28/2006 at 1340
Comment 14 hemant_bedekar 2006-09-29 01:34:43 UTC
I cannot upload the memory dumps to IssueZilla because files are too big. I have
kept the memory dumps here - ftp://ftp.seebeyond.com/pub/hemant/HPROF/ 

If the files get deleted as part of periodical cleanup, please contact me
(hemant.bedekar@sun.com) and I will upload the files again.
Comment 15 Rich Unger 2006-09-30 00:15:02 UTC
Okay, here's a recipe for reproducing the problem, using only a simple Web
Project (nothing from BPEL) in NetBeans 5.0 with jdk 1.5.0_06:

1. Create a new web project
2. Windows...Runtime...Servers...Bundled Tomcat...Properties...Platform...VM
Options: -Dcom.sun.management.jmxremote
3. Start the internal tomcat server
4. $JAVA_HOME/bin/jconsole.exe
5. In JConsole, connect to the catalina VM
(org.apache.cataline.startup.Bootstrap start)
6. In the Memory tab, select "Memory Pool 'Perm Gen'" from the "Chart" combo box
7. Deploy the webapp in NB
8. Go to Step 7

Each time you deploy, your PermGen space usage will monotonically increase.  The
effect is more pronounced if you add libraries to your webapp (like JSF)
Comment 16 _ gsporar 2006-09-30 02:21:49 UTC
Rich, is that really a bug in NetBeans?  It looks like Tomcat is where the bug
is, right?  It's the one that is running out of Perm Gen space - or am I not
understanding something correctly here?

FYI, from the Tomcat bug database:
http://issues.apache.org/bugzilla/show_bug.cgi?id=33711
Comment 17 Sreenivasan Genipudi 2006-09-30 05:18:36 UTC
 profiled the memory leak that’s happening during bpel project build. This is
what I observed. 

If the following Netbeans APIs calls are made from the ant tasks.

   1) Calling Lookup method on the Lookup obtained from Lookups.metaInfServices();
   from Ant task

  2)       Create WeakReference/ WeakListner during build in the code  

Both the APIs seems to add reference to ActiveQueue which helds reference to the 
Build classloader and never releases after the build.

To fix this problem - Replaced Lookups.metaInfServices() with  
javax.imageio.spi.ServiceRegistry in bpel project code  and Removed the
WeakReference creation in org.netbeans.modules.xml.xam.dom.
AbstractDocumentModel (XAM)

I have checked in the bpel project code in release55_dev branch and have
requested Chris Webster to make the AbstractDocumentModel .





Comment 18 Sreenivasan Genipudi 2006-09-30 05:22:42 UTC
Created attachment 34743 [details]
weak reference creating ActiveQueue
Comment 19 Sreenivasan Genipudi 2006-09-30 05:23:15 UTC
Created attachment 34744 [details]
MetaInfServices.Lookup() creating activequeue
Comment 20 Rich Unger 2006-10-02 23:25:12 UTC
Perhaps my general webapp issue is a completely different thing?  Shall I file a
separate issue?

Gregg- My problem is certainly not the referenced tomcat bug, as a simple webapp
created from NB templates doesn't match any of the 3 necessary criteria.  It may
be a different tomcat bug altogether, but I suspect there's an equal chance that
the tomcatint module is responsible for signaling to tomcat in some way that the
webapp is being overwritten, and the old context can be undeployed and its
classloader released.
Comment 21 _ gsporar 2006-10-03 19:51:00 UTC
Hi, Rich.

I would agree with your assessment that whatever the cause of what you are
seeing, it is not that known Tomcat bug that I listed in my comment.

I'm still not completely convinced, though, that what you are seeing is a bug in
NetBeans.  I recreated part of your experiment and started up Tomcat and
attached to it with JConsole.  Using Tomcat's Manager user interface (instead of
NetBeans) I repeatedly redployed (the button is labeled "Reload" in the Tomcat
Manager UI) a simple web application and I saw perm gen increase in size (by
about 8K) each time.

In either case, I think what we're seeing is different than what was described
in this IZ, so in answer to your question, I would vote "yes," please open a new IZ.
Comment 22 Rich Unger 2006-10-03 20:32:04 UTC
Gregg- I posted Issue 86407.
Comment 23 Sreenivasan Genipudi 2006-10-05 04:28:37 UTC
This issue is with respective to Memory leak happening in bpel project build
perspective as mentioned by Tientien Li(tli). 

1) Create Sample Synchronous Bpel project ( or any Bpel project) 
2) Build and Clean ( repeat more than 20 times) 

It was failing after 35 runs for me. 

Comment 24 Sreenivasan Genipudi 2006-10-05 04:30:42 UTC
Modifying the Bpel project build to use classes loaded by Netbeans classloader
rather than creating a new classloader for every build with fixed Jars in the
classpath seems to solve this problem. I am still testing the fix.
Comment 25 Sreenivasan Genipudi 2006-10-05 08:37:51 UTC
The fix is checked into release55_dev.  The fix is to use classes loaded from
netbeans instead of creating anttasks fresh for each new build. 

Code changes: 
project/antsrc/org/netbeans/modules/bpel/project/antlib.xml
project/antsrc/org/netbeans/modules/bpel/project/anttasks/IDEBPELCatalogModel.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/IDEGenerateJBIDescriptor.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/IDEJBIGenerator.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/IDEValidateBPELProject.java
project/build.xml
project/antsrc/org/netbeans/modules/bpel/project/anttasks/BPELCatalogModel.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/GenerateJBIDescriptor.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/JBIGenerator.java
project/antsrc/org/netbeans/modules/bpel/project/anttasks/ValidateBPELProject.java
project/nbproject/project.properties
project/nbproject/private/private.xml
project/src/org/netbeans/modules/bpel/project/resources/build-impl.xsl
project/src/org/netbeans/modules/bpel/project/resources/build.xsl
project/test/unit/src/org/netbeans/modules/bpel/project/anttasks/TestCreateBPELModel.java
project/test/unit/src/org/netbeans/modules/bpel/project/anttasks/testBuilds/testModel.xml
project/test/unit/src/org/netbeans/modules/bpel/project/anttasks/testBuilds/testRole.xml
project/test/unit/src/org/netbeans/modules/bpel/project/anttasks/testBuilds/testValidation.xml
Comment 26 Ritesh Adval 2006-10-06 04:47:34 UTC
This change looks fine to me.
Comment 27 Sreenivasan Genipudi 2006-10-07 06:49:59 UTC
I did clean and build on Synchronous sample project 100 times and Outof memory
error didnt happen. You can try this on any bpel project. Please use next
enterprise pack release build for testing.
Comment 28 Antonin Nebuzelsky 2006-12-04 23:10:01 UTC
This is marked as fixed in 5.5, but the integration seems to have been done to
release55_dev, not to release55. Is it really fixed in released EntPack 5.5? A
user on nbusers is reporting this problem with Netbeans IDE 5.5 (Build
200610171010).
Comment 29 Mikhail Kondratyev 2006-12-11 07:17:26 UTC
I could not see any response to the last message. Reopening this bug to make
sure we track the situation.

hemant_bedekar could you please confirm the bug is fixed?
Comment 30 Sergey Lunegov 2007-02-06 14:17:24 UTC
Mikhail, would you please verify whether bug is still reproducible in Gavotte ?
Comment 31 Mikhail Kondratyev 2007-02-07 12:28:58 UTC
Could not reproduce the bug with Gavotte milestone build 6
Closing as fixed

Comment 32 Victoria Zhukovskaya 2007-05-31 14:27:14 UTC
Created attachment 43037 [details]
Screenshot
Comment 33 Victoria Zhukovskaya 2007-05-31 14:27:39 UTC
NetBeans IDE Dev (Build 200705300000)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
Windows XP version 5.1 running on x86
en_US (nb); Cp1252

Outof memory error didnt happen after Clean/Build bpel project  (more then 10 times)

see attacment with memory pool of this action.
It looks good