JAX-WS client invocation time keeps increasing over life of JVM in EAP 6

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

JAX-WS client invocations keep increasing over the life of the JVM. Some notes about the client:

  • The Service object is cached between invocations

  • To ensure the application's custom JAX-WS handlers are set on the port, ((BindingProvider)port).getBinding().setHandlerChain(handlerChain) is invoked before every invocation.

  • The handler chain can also just be set once to cause the issue:

      final Service service = Service.create(wsdl, ns);
      service.setHandlerResolver(new HandlerResolver() {
        public List<Handler> getHandlerChain(PortInfo info) {
          log.warn("Retrieving custom handler chain");
          return handlerChain;
        }
      });
    
  • There are lots of stack traces like this in a tread dump with the issue, showing high CPU in org.apache.cxf.phase.PhaseInterceptorChain.add:

      "http-/10.150.85.229:8080-74" daemon prio=10 tid=0x00007f9fe0043800 nid=0x7a76 runnable [0x00007fa06f4dc000]
         java.lang.Thread.State: RUNNABLE
        at org.apache.cxf.phase.PhaseInterceptorChain.insertInterceptor(PhaseInterceptorChain.java:494)
        at org.apache.cxf.phase.PhaseInterceptorChain.add(PhaseInterceptorChain.java:208)
        at org.apache.cxf.phase.PhaseInterceptorChain.add(PhaseInterceptorChain.java:185)
        at org.apache.cxf.phase.PhaseInterceptorChain.add(PhaseInterceptorChain.java:176)
        at org.apache.cxf.phase.PhaseChainCache.getChain(PhaseChainCache.java:93)
        at org.apache.cxf.phase.PhaseChainCache.get(PhaseChainCache.java:77)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:744)
    

Resolution

This is a bug as described in Content from issues.apache.org is not included.CXF-6038. There is no known workaround short of removing all JAX-WS handlers. Follow the EAP product bugzillas to know when the fix is released in EAP:

Moreover, Content from issues.jboss.org is not included.JBWS-3847 removes JBossWS integration code that was greatly aggravating the issue in CXF.

If a patch for an earlier version of EAP is desired, please open a support case and reference this issue.

Root Cause

When CXF detects that JAX-WS handlers are configured, it will add its handler interceptors to manage the execution of JAX-WS handlers. If a CXF Bus is reused, each new invocation will cause CXF to check for the presence of JAX-WS handlers and add the interceptors. The bug fix adds a simple boolean to mark the handler interceptors as added so that they don't get re-added.

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.