You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2009/11/16 14:37:52 UTC

[jira] Commented: (CAMEL-2175) Initialization code of camel-cxf is not thread safe

    [ https://issues.apache.org/activemq/browse/CAMEL-2175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55452#action_55452 ] 

Claus Ibsen commented on CAMEL-2175:
------------------------------------

If you hit it concurrently you get NPEs

{code}
Nov 16, 2009 2:40:03 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
WARNING: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
        at org.apache.camel.component.cxf.DefaultCxfBinding.propagateHeadersFromCxfToCamel(DefaultCxfBinding.java:406)
        at org.apache.camel.component.cxf.DefaultCxfBinding.populateExchangeFromCxfRequest(DefaultCxfBinding.java:209)
        at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:84)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:880)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
{code}

> Initialization code of camel-cxf is not thread safe
> ---------------------------------------------------
>
>                 Key: CAMEL-2175
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2175
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.0.0
>            Reporter: Claus Ibsen
>             Fix For: 2.1.0, 2.2.0
>
>
> getCxfBinding is not thread safe in case multiple threads hit a CXF webserive at once and it hasnt been initialized before.
> Code like this
> {code}
>     public CxfBinding getCxfBinding() {
>         if (cxfBinding == null) {
>             cxfBinding = new DefaultCxfBinding();   
>             if (LOG.isDebugEnabled()) {
>                 LOG.debug("Create default CXF Binding " + cxfBinding);
>             }
>         }
>         
>         if (!cxfBindingInitialized.getAndSet(true) 
>                 && cxfBinding instanceof HeaderFilterStrategyAware) {
>             ((HeaderFilterStrategyAware)cxfBinding)
>                 .setHeaderFilterStrategy(getHeaderFilterStrategy());
>         }
>         return cxfBinding;
>     }
> {code}
> Is a false sense as the {{getAndSet}} will let other threads pass it with a cxfBinding that still may not have been initialized.

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