Bug 1158330 - [GSS] (6.3.z) Memory leak in JBoss WS CXF Client's HandlerChainSortInterceptor
Summary: [GSS] (6.3.z) Memory leak in JBoss WS CXF Client's HandlerChainSortInterceptor
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web Services
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: CR1
: EAP 6.3.3
Assignee: baranowb
QA Contact: Rostislav Svoboda
Depends On: 1155490
Blocks: eap633-payload 1157479
TreeView+ depends on / blocked
Reported: 2014-10-29 06:02 UTC by Tadayoshi Sato
Modified: 2020-12-11 11:44 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1155490
Last Closed: 2019-08-19 12:39:23 UTC
Type: Bug

Attachments (Terms of Use)
6.3.2-vs-6.3.3 (232.97 KB, image/png)
2015-01-20 09:14 UTC, Rostislav Svoboda
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBWS-3847 0 Major Closed Memory leak in JBoss WS CXF Client's HandlerChainSortInterceptor 2017-10-18 09:23:30 UTC

Description Tadayoshi Sato 2014-10-29 06:02:48 UTC
+++ This bug was initially created as a clone of Bug #1155490 +++

Description of problem:
Platform BZ for https://issues.jboss.org/browse/JBWS-3847

HandlerChainSortInterceptor.handleMessage(Message) sorts and sets JAX-WS handlers every time it handles a SOAP message:

   public void handleMessage(Message message) throws Fault
      if (binding != null) {
         List<Handler> list = binding.getHandlerChain();
         if (list != null && !list.isEmpty()) {
            Collections.sort(list, comparator);

However, inside the org.apache.cxf.jaxws.binding.AbstractBindingImpl and org.apache.cxf.jaxws.support.JaxWsEndpointImpl implementations the handler chain is not reset every time but piled up with interceptors, which leads to subtle but indefinite memory leak in JBoss WS CXF client.

Furthermore, org.apache.cxf.jaxws.support.JaxWsEndpointImpl holds the interceptors as a kind of java.util.concurrent.CopyOnWriteArrayList. So modifying the growing list of interceptors per each message should cause a growing performance drawback, which is also not a good implementation.

How reproducible:

Steps to Reproduce:
1. Implement a JAX-WS client with one JAX-WS handler
2. Run the client invoking the service port method indefinitely

Actual results:
You'll see memory leak (= increase of memory usage).

Expected results:
Memory leak should not happen.

Comment 2 JBoss JIRA Server 2014-10-30 10:07:56 UTC
Alessio Soldano <asoldano@redhat.com> updated the status of jira JBWS-3847 to Resolved

Comment 4 Rostislav Svoboda 2015-01-20 09:13:49 UTC
Verified on EAP 6.3.3 CR1. Custom app created, execute 1 million iterations. Screenshot of jconsole attached

Comment 5 Rostislav Svoboda 2015-01-20 09:14:16 UTC
Created attachment 981781 [details]

Comment 6 JBoss JIRA Server 2015-04-25 20:26:42 UTC
Alessio Soldano <asoldano@redhat.com> updated the status of jira JBWS-3847 to Closed

Note You need to log in before you can comment on or make changes to this bug.