On GlassFish Server JAX-WS Web Service Calls Result in a Memory Leak Due to org.glassfish.weld.services.JCDIServiceImpl$JCDIInjectionContextImpl Objects Being Cached in a com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl (Doc ID 1639840.1)

Last updated on JULY 12, 2017

Applies to:

Oracle GlassFish Server - Version 3.1.2 and later
Information in this document applies to any platform.

Symptoms

A memory leak is spotted or an OutOfMemoryError occurs in an application that makes heavy use of a JAX-WS web service.  For example:

@WebService(serviceName = "EchoWebService")
public class EchoWebService {

    /**
     * This is a sample web service operation
     */
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String txt) {
        System.out.println("HELLO WEBSERVICE CALLED");
        return "Hello " + txt + " !";
    }
}

Everytime the above web service is invoked an instance of org.glassfish.weld.services.JCDIServiceImpl$JCDIInjectionContextImpl is created and is not removed.  The references to these injection context objects are held in an instance of com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.  Over time, under sufficient load, this could lead to all the free space on the Java heap being consumed.

Changes

 

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