metro-jax-ws icon indicating copy to clipboard operation
metro-jax-ws copied to clipboard

Service.getPort generates new proxy classes on every call

Open Tomas-Kraus opened this issue 2 years ago • 0 comments

When JAX-WS RI is deployed on the latest versions of Java 7 or Java 8, each call to javax.xml.ws.Service.getPort() generates a new set of proxy classes. This fills up PermGen/MetaSpace. The issue is amplified on Java 8 by the fact that MetaSpace does not have a limited size by default.

This appears to be caused by a change in the implementation of java.lang.reflect.Proxy. The cache of proxy classes no longer takes equality of ClassLoaders into account, one must use the same ClassLoader instance to get a cache hit. WSServiceDelegate generates a new instance of DelegatingLoader every time getPort() is called, and thus incurs a cache miss when calling Proxy.newProxyInstance().

The java.lang.reflect.Proxy implementation was changed to resolve the following issue: http://bugs.java.com/view_bug.do?bug_id=7123493

Environment

Java 7u60+ Java 8

Affected Versions

[2.2.6, 2.2.7, 2.2.8]

Source: https://github.com/javaee/metro-jax-ws/issues/1161 Author: glassfishrobot

Tomas-Kraus avatar Jun 02 '22 17:06 Tomas-Kraus