[
http://jira.jboss.com/jira/browse/JBAS-2299?page=comments#action_12409517 ]
Mike Millson commented on JBAS-2299:
------------------------------------
I implemented the Listener Service[1] to clear the PropertyUtils cache; however, I still
got OOME after the same number of redeployments, and the heap dump looks the same.
Attached are the complete UndeploymentNotificationListenerMBean and
UndeploymentNotificationListener implementation. Here is the handle2Notification method:
/**
* Overriden to flush BeanUtils cache.
*
* This is a workaround until the following BeanUtils bug is fixed:
*
https://issues.apache.org/jira/browse/BEANUTILS-291
*/
public void handleNotification2(Notification notification, Object handback) {
log.info("Got notification: " + notification + ", handback: "
+ handback);
org.apache.commons.beanutils.PropertyUtils.clearDescriptors();
log
.info("System.out.println(MappedPropertyDescriptor.class.getClassLoader()): "
+ MappedPropertyDescriptor.class.getClassLoader());
Class<?> clazz = MappedPropertyDescriptor.class;
Field field = null;
try {
field = clazz.getDeclaredField("declaredMethodCache");
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
field.setAccessible(true);
// Map table = null;
Hashtable table = null;
try {
// table = (Map) field.get(null);
table = (Hashtable) field.get(null);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (table != null) {
table.clear();
} else {
log.info("Table is null. Nothing to clear :-(");
}
}
Classloader logging shows the following:
23:24:53,032 INFO [UndeploymentNotificationListener]
MappedPropertyDescriptor.class.getClassLoader():
org.jboss.mx.loading.UnifiedClassLoader3@a6a435f{
url=file:/home/mmillson/jems/bin/jboss-eap-4.3/jboss-as/server/167533/deploy/jboss-web.deployer/
,addedOrder=6}
Deployment steps:
1) Jar up UndeploymentNotificationListenerMBean and UndeploymentNotificationListener and
deploy to JBOSS_HOME/server/SERVERCONF/lib.
2) Add the following to
JBOSS_HOME/server/SERVERCONF/deploy/JBOSS_WEB/META-INF/jboss-service.xml:
<mbean code="testbox.jmx.UndeploymentNotificationListener"
name="testbox.jmx:name=UndeploymentNotificationListener">
<attribute name="SubscriptionList">
<subscription-list>
<!-- Listen for undeployment of webapps -->
<mbean name="jboss.web:service=WebServer">
<notification
type="org.jboss.deployment.SubDeployer.destroy"/>
</mbean>
</subscription-list>
</attribute>
</mbean>
[
1]http://wiki.jboss.org/wiki/ExampleMinimalNotificationListener
OutOfMemory error when repetatively deploying and undeploying with 10
minute interval
-------------------------------------------------------------------------------------
Key: JBAS-2299
URL:
http://jira.jboss.com/jira/browse/JBAS-2299
Project: JBoss Application Server
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: Deployment services
Affects Versions: JBossAS-4.0.3RC2
Environment: WinXP SP2, JBoss 4.0.3RC2, JDK 1.4.2_07
Reporter: Amar Syed
Assigned To: Clebert Suconic
Attachments: Data.txt, deploy-undeploy.sh, paths-from-GC-roots.png,
SampleApp.ear, Sampleapp.zip, UndeploymentNotificationListenerMBean.java,
UndeploymentNotificationListenerMBean.java
Time Spent: 2 hours
Remaining Estimate: 0 minutes
Using a manual copy and delete mechanism with the server\default\deploy folder the sample
ear (attached) caused an outofmemory error eventually after 90 repetitions.
The min and max heap settings were configured as : -Xms128m -Xmx512m
The time delay after dropping/deploying the ear at each repetition was set to 10 minutes
after which the ear is deleted/undeployed followed by a 10 second sleep till the next
deploy cycle.
I find this behaviour strange because
http://jira.jboss.com/jira/browse/JBAS-1319 is
supposed to have fixed this issue.
The lines from the server.log surrounding the java.lang.OutOfMemoryError are as follows:
2005-09-24 06:04:31,413 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with
url null
2005-09-24 06:04:31,413 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository,
repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@e51e50,
cl=org.jboss.mx.loading.UnifiedClassLoader3@c90207{ url=null ,addedOrder=0}
2005-09-24 06:04:33,057 ERROR [org.apache.commons.digester.Digester] Begin event threw
error
java.lang.OutOfMemoryError
2005-09-24 06:04:33,057 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/XMPVXE0Partion/VXE1_ContentTestService]]
StandardWrapper.Throwable
java.lang.OutOfMemoryError
2005-09-24 06:04:33,057 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/XMPVXE0Partion/VXE1_ContentTestService]]
Servlet /XMPVXE0Partion/VXE1_ContentTestService threw load() exception
java.lang.OutOfMemoryError
2005-09-24 06:04:33,072 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with
url null
The following two jars were added to the server\default\lib folder.
commons-validator.jar --- version 1.1.3
struts.jar ---- version 1.2.4
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira