Memory Leak After every Redeployment using Hibernate/Weld in GlassFish Server 3.0 (Doc ID 1301048.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle GlassFish Server - Version: 3.0 to 3.0.1 - Release: 3.0 to 3.0
Information in this document applies to any platform.

Symptoms

GlassFish Server 3.0 leaks Java memory when a repeated redeployment of the an application that uses Hibernate is performed. After a couple of redeployment, the GlassFish server log runs out of PermGen space, and throws an OutOfMemoryError Java Exception in the logs (server.log) as follows :-

server.log
[#|2011-03-16T14:54:02.625+0800|SEVERE|glassfishv3.0|
javax.enterprise.system.tools.admin.com.sun.enterprise.v3.admin|
_ThreadID=30;_ThreadName=Thread-1;|Exception in command execution : java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.printStackTrace(Throwable.java:510)
at com.sun.enterprise.server.logging.UniformLogFormatter.uniformLogFormat
(UniformLogFormatter.java:293)
at com.sun.enterprise.server.logging.UniformLogFormatter.format
(UniformLogFormatter.java:145)
at java.util.logging.StreamHandler.publish(StreamHandler.java:179)
at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:88)
at java.util.logging.Logger.log(Logger.java:481)
at java.util.logging.Logger.doLog(Logger.java:503)
at java.util.logging.Logger.log(Logger.java:592)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute
(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute
(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
|#]

The GlassFish admin command (asadmin)  may show the following
# asadmin deploy leak.war
com.sun.enterprise.admin.cli.CommandException: remote failure: java.lang.OutOfMemoryError: PermGen space
PermGen space
Command deploy failed.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms