i've got springroo-based application running in production environment, causing severe permgen memory leaks after hot redeploys.
in order "find , fix" leak , reduce variables during analysis, i've created simple, streamlined application using roo, , obtain same behaviour. project (created spring roo (1.2.3.release)) persists entity called 'person' string field called 'name'.
i deploy war on tomcat 7.0.39, using oracle 11.2.0.2 database. after every re-deploy, message in catalina.out
info: undeploying context [/ojdbc-0.1.0.build-snapshot] mag 06, 2013 10:50:43 org.apache.catalina.loader.webappclassloader clearreferencesjdbc severe: web application [/ojdbc-0.1.0.build-snapshot] registered jdbc driver [oracle.jdbc.oracledriver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered.
after 2 hot-redeploys, permgen error:
mag 06, 2013 10:51:08 org.apache.catalina.startup.hostconfig deploywar info: deploying web application archive /applications/apache-tomcat-7.0.39/webapps/ojdbc- 0.1.0.build-snapshot.war exception in thread "containerbackgroundprocessor[standardengine[catalina]]" exception: java.lang.outofmemoryerror thrown uncaughtexceptionhandler in thread "containerbackgroundprocessor[standardengine[catalina]]" exception in thread "rmi tcp connection(idle)" mag 06, 2013 10:51:17 servercommunicatoradmin reqincoming warning: server has decided close client connection. java.lang.outofmemoryerror: permgen space exception in thread "rmi tcp connection(idle)" java.lang.outofmemoryerror: permgen space
i've tried analyze visualvm / eclipsememory analyzer, , far.
the fact don't observe behaviour database (for example postgresql or hypersonic). there related oracle causing leak?
here zip archive containing roo script generator, anche .hprof dump file.
try moving oracle jdbc driver tomcat's lib directory instead of being inside of application's lib folder. looks oraclediagnosabilitymbean getting handle on catalina.
edit: since not have control on tomcat, try wrap oracle classes getting loaded (except replace appcontext oracle init):
http://cdivilly.wordpress.com/2012/04/23/permgen-memory-leak/
//somewhere in application startup, e.g. servletcontextlistener try { final classloader active = thread.currentthread().getcontextclassloader(); try { //find root classloader classloader root = active; while (root.getparent() != null) { root = root.getparent(); } //temporarily make root class loader active class loader thread.currentthread().setcontextclassloader(root); //force appcontext singleton created , initialized sun.awt.appcontext.getappcontext(); } { //restore class loader thread.currentthread().setcontextclassloader(active); } } catch ( throwable t) { //carry on if error log.warning("failed address permgen leak"); }
Comments
Post a Comment