Increased processing time in SOAPHandlers after updating JBoss EAP

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.4.24 - 7.4.25
    • 8.0 update 5-update 10
    • EAP 8.1 update 1

Issue

  • After updating JBoss EAP, an increasing amount of time is spent in a custom application SOAPHandler with each invocation:
	at app.package.CustomSoapHandler.handleMessage(CustomSoapHandler.java:42)
	at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandleMessage(HandlerChainInvoker.java:355)
	at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandlerChain(HandlerChainInvoker.java:254)
	at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeProtocolHandlers(HandlerChainInvoker.java:131)
	at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessageInternal(SOAPHandlerInterceptor.java:166)
	at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.access$000(SOAPHandlerInterceptor.java:70)
	at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor$1.handleMessage(SOAPHandlerInterceptor.java:80)
	at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor$1.handleMessage(SOAPHandlerInterceptor.java:77)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	- locked <0x00000000f5b91f68> (a org.apache.cxf.phase.PhaseInterceptorChain)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:441)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:356)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)

Resolution

  • Note that after Content from redhat.atlassian.net is not included.JBWS-4453, this port caching is disabled by default in EAP 7.4.26+, 8.0 update 11+ and 8.1 update 2+ so updating to these will avoid the port caching and any such resulting problem symptom. On these versions, this port cache can be enabled if desired by passing the new org.jboss.wsf.stack.cxf.client.CachePortFeature to Service.create() or service.getPort() methods:
   URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-shared-ports?wsdl");
   QName serviceName = new QName(targetNS, "TestEndpointService");
   Service service = Service.create(wsdlURL, serviceName, new CachePortFeature());
  • If enabling the cache port or using it on a version where it is forcibly enabled, ensure any custom SOAPHandler is only added once on a given port binding.

Root Cause

  • [JBEAP-30465 This content is not included.GSS JBWS-4445 - Implement ports cache for service instances](https://issues.redhat.com/browse/JBEAP-30465) adds port caching in EAP 7.4.24-7.4.25, EAP 8.0 update 5-update 10 and EAP 8.1 update 1, which cannot be disabled. If an application is written to get the port and add a SOAPHandler to the port binding with every invocation, then the same port instance can now be returned and reused from cache with any past handlers still present on the port binding. This can then result in an additional instance of a custom SOAPHandler being added to the port binding with every invocation so that the SOAPHandler.handleMessage method has to then be called n times, where is n is the number of total invocations thus far and the number of times the duplicate SOAPHandler class has been added.
Components
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.