You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2009/04/29 11:12:39 UTC

[jira] Resolved: (SMXCOMP-504) ConcurrentModificationExceptions under heavy load in CXF BC

     [ https://issues.apache.org/activemq/browse/SMXCOMP-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved SMXCOMP-504.
----------------------------------

    Resolution: Fixed

commit fix
http://svn.apache.org/viewvc?rev=769692&view=rev for 3.2 branch
http://svn.apache.org/viewvc?rev=769693&view=rev for servicemix-cxf-se project
http://svn.apache.org/viewvc?rev=769724&view=rev for servicemix-cxf-bc project

> ConcurrentModificationExceptions under heavy load in CXF BC
> -----------------------------------------------------------
>
>                 Key: SMXCOMP-504
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-504
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-cxf-bc, servicemix-cxf-se
>    Affects Versions: servicemix-cxf-bc-2008.01, servicemix-cxf-se-2008.01
>            Reporter: Martin Murphy
>            Assignee: Freeman Fang
>             Fix For: 3.2.4, servicemix-cxf-bc-2009.02, servicemix-cxf-se-2009.02
>
>
> Under heavy load ServiceMix throws occasional ConcurrentModificationExceptions with this stack trace:
> {noformat}
> Caused by: java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
> at java.util.AbstractList$Itr.next(AbstractList.java:343)
> at org.apache.cxf.phase.PhaseInterceptorChain.add(PhaseInterceptorChain.java:168)
> at org.apache.cxf.phase.PhaseInterceptorChain.add(PhaseInterceptorChain.java:160)
> at org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:227)
> at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:621)
> at org.apache. servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:575)
> at org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:531)
> at org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
> at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
> at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
> at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:16
> {noformat}
> The reason for this is that the CXF [example|http://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/cxf_provider_consumer_bridge.xml] from the [documentation|http://servicemix.apache.org/servicemix-cxf-bc.html] adds the interceptors as a list :
> {code:xml}
> <cxfbc:inInterceptors>
>     <ref bean="LoggingInInterceptor"/>
> </cxfbc:inInterceptors>
> <cxfbc:outInterceptors>
>     <ref bean="LoggingOutInterceptor"/>
> </cxfbc:outInterceptors>
> <cxfbc:inFaultInterceptors>
>     <ref bean="LoggingInInterceptor"/>
> </cxfbc:inFaultInterceptors>
> <cxfbc:outFaultInterceptors>
>     <ref bean="LoggingOutInterceptor"/>
> </cxfbc:outFaultInterceptors>
> {code}
> For example this then gets set as a list when injected by Spring
> {code}
>     List<Interceptor> in = new CopyOnWriteArrayList<Interceptor>();
> // ... SNIP ...
>     /**
>         * Specifies a list of interceptors used to process requests recieved
>         * by the endpoint.
>         *
>         * @param interceptors   a list of <code>Interceptor</code> objects
>         * @org.apache.xbean.Property description="a list of beans configuring interceptors that process incoming requests"
>         * */
>     public void setInInterceptors(List<Interceptor> interceptors) {
>         in = interceptors;
>     }
> {code}
> The CopyOnWriteArrayList is lost and can lead to the ConcurrentModificationException.
> One possible solution is to update the Spring configuration for the interceptors to wrap it in a CopyOnWriteArrayList.
> {code:xml}
> <property name="inInterceptors">
>     <util:list list-class="java.util.concurrent.CopyOnWriteArrayList">
>         <ref bean="LoggingInInterceptor"/>
>     </util:list>
> </property>
> <property name="outInterceptors">
>     <util:list list-class="java.util.concurrent.CopyOnWriteArrayList">
>         <ref bean="LoggingOutInterceptor"/>
>     </util:list>
> </property>
> <property name="inFaultInterceptors">
>     <util:list list-class="java.util.concurrent.CopyOnWriteArrayList">
>         <ref bean="LoggingInInterceptor"/>
>     </util:list>
> </property>
> <property name="outFaultInterceptors">
>     <util:list list-class="java.util.concurrent.CopyOnWriteArrayList">
>         <ref bean="LoggingOutInterceptor"/>
>     </util:list>
> </property>
> {code}
> This is probably overkill since the setter methods could probably handle
> this by adding the list to the existing CopyOnWriteArrayList rather than
> overwriting the existing object, for example:
> {code}
>     /**
>         * Specifies a list of interceptors used to process requests recieved
>         * by the endpoint.
>         *
>         * @param interceptors   a list of <code>Interceptor</code> objects
>         * @org.apache.xbean.Property description="a list of beans configuring interceptors that process incoming requests"
>         * */
>     public void setInInterceptors(List<Interceptor> interceptors) {
>         in.addAll(interceptors);
>     }
> {code}
> This would allow current configurations to avoid possible ConcurrentModificationExceptions 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.