[GLASSFISH-18787] Classloader leak in com.sun.xml.ws.server.WSEndpointImpl Created: 06/Jun/12  Updated: 20/Dec/16  Resolved: 26/Jul/12

Status: Resolved
Project: glassfish
Component/s: web_services
Affects Version/s: 3.1.2
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: syvalta Assignee: Lukas Jungmann
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Tags: metro2_2_1-waived


After undeploying a web app which uses JAX-WS web services LazyMOMProvider still references the WS implementation class. This causes all the classes loaded by the web app classloader to be referenced until the app server restart.

jhat dump:
--> class com.sun.xml.ws.api.server.LazyMOMProvider (160 bytes) (static field INSTANCE
--> com.sun.xml.ws.api.server.LazyMOMProvider@0xe0821148 (52 bytes) (field endpointsWaitingForMOM
--> java.util.HashSet@0xe082b0e8 (24 bytes) (field map
--> java.util.HashMap@0xe08323f0 (64 bytes) (field table
--> [Ljava.util.HashMap$Entry;@0xe66afe18 (528 bytes) (Element 16 of [Ljava.util.HashMap$Entry;@0xe66afe18
--> java.util.HashMap$Entry@0xe87f13b8 (44 bytes) (field key
--> com.sun.xml.ws.server.WSEndpointImpl@0xe87f1c48 (194 bytes) (field implementationClass
--> class com.test.TestWebServiceImpl (160 bytes) (??
--> org.glassfish.web.loader.WebappClassLoader@0xe82706a8 (324 bytes)

It seems that this if clause in WSEndpoinImpl.closeManagedObjectManager evaluates to true and thus prevents the unregistration:

// ManagedObjectManager doesn't need to be closed because it exists only as a proxy
if (managedObjectManager instanceof WSEndpointMOMProxy
&& !((WSEndpointMOMProxy)managedObjectManager).isInitialized())

{ close = false; }

Comment by syvalta [ 06/Jun/12 ]

The instance is always registered during creation in the constructor, so it should be unconditionally unregistered in the dispose. I guess the fix would be to move LazyMOMProvider.INSTANCE.unregisterEndpoint(this) out of the if blocks so that it is always executed.

Comment by Lukas Jungmann [ 19/Jun/12 ]

fixed in jaxws-ri workspace[1], will get to GF in the next integration

[1]: http://java.net/projects/jax-ws/sources/sources/revision/13203

Comment by Lukas Jungmann [ 26/Jul/12 ]

integrated in svn r.55202

Generated at Sat Feb 25 17:00:23 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.