Hi Sergey, Sorry for the late response, I could not work today on the issue - other things to do :-(. I will reproduce it tomorrow and send you the full code, together with the JMX for JMeter load test.
Note in my test, with 10 concurrent threads it was failing on more than 20 percent of the requests. Best regards, /Dumitru On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] < [email protected]> wrote: > As a sanity check I've run the multi-threaded test on the trunk and > 2.9.x due to diff CXF versions being used there, still things work OK. > > Dumitru, I've been telling everyone CXF RS producer is broken :-), so > need your help with reproducing the case. Are you having multiple > threads running within a route builder itself ? Please provide more info > > Sergey > On 25/07/12 14:44, Sergey Beryozkin wrote: > > > Dumitru, > > > > I'm not seeing in > > http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml > > how the route is initiated, can you provide the source of the updated > > org.apache.camel.example.cxf.CamelRoute ? > > > > I've updated one of the tests which Willem created to get 500 threads > > stressing the rs client code, can not reproduce the issue > > > > Cheers, Sergey > > > > On 24/07/12 02:45, Willem Jiang wrote: > >> On Tue, Jul 24, 2012 at 6:16 AM, Sergey > >> Beryozkin<[hidden > >> email]<http://user/SendEmail.jtp?type=node&node=5716473&i=0>>wrote: > > >> > >>> Hi > >>> > >>> On 23/07/12 17:38, dumi_p wrote: > >>> > >>>> Hi all, > >>>> > >>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test > >>>> following > >>>> scenario: > >>>> > >>>> 1. Have a CXF rest service deployed > >>>> 2. Have a proxy CXF rest service over the service above, deployed > under > >>>> the > >>>> same Camel instance > >>>> > >>>> It works fine, until I perform requests in parallel. Exception > >>>> stacktrace > >>>> is > >>>> attached. > >>>> http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.* > >>>> *txt<http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt> > >>>> stacktrace.txt > >>>> > >>>> I tried following things in class > >>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it: > >>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no > >>>> success > >>>> 2. Added synchronization point over line WebClient client = > >>>> cfb.createWebClient(), from invokeHttpClient method. It works, but > >>>> performance dropped on my localhost from 150 requests per second to > 10 > >>>> requests per second, so the fix is not acceptable. > >>>> > >>>> I attach my camel-config.xml - please let me know if additional info > is > >>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-** > >>>> config.xml< > http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml> > >>>> > >>>> camel-config.xml > >>>> > >>>> I am not sure if the problem lies in the configuration I performed > >>>> or in > >>>> the > >>>> cxf-rs component or in cxf itself. > >>>> > >>>> Any idea is appreciated. > >>>> > >>>> Well,I look at the code and see some JAXRSClientFactoryBean cache - > >>> Willem can you comment on this please ? This looks suspicious. > >>> > >> > >> I don't like the JAXRSClientFactoryBean cache either, it is used to > >> create the WebClient if we change the URI per request. Now I just want > to > >> ask if there is a way to override the server address by setting the > >> context > >> per request in the WebClient. > >> > >> If So , it could easy for use to resolve the issue. > >> > >> > >>> The trace shows that the thread safety is compromised at the point of > >>> creating web clients. I can work on a patch - though will take me a > >>> bit of > >>> time to get to it > >>> > >>> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2] > >>> explicitly, with a thread safe flag set and reuse it in the routes > >>> directly > >>> ? That should do it. > >>> > >>> Thanks > >>> Sergey > >>> > >>> [1] > >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI- > >>> **ConfiguringHTTPclientsinSpring< > http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring> > > >>> > >>> [2] > >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI- > >>> **ConfiguringproxiesinSpring< > http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring> > > >>> > >>> [2] > >>> > >>> > >>> Best regards, > >>>> Dumitru > >>>> > >>>> > >>>> > >>>> -- > >>>> View this message in context: http://camel.465427.n5.nabble.** > >>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html< > http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html> > > >>>> > >>>> Sent from the Camel - Users mailing list archive at Nabble.com. > >>>> > >>> > >>> > >> > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716473.html > To unsubscribe from CxfRsProducer is not thread safe, click > here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==> > . > NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716475.html Sent from the Camel - Users mailing list archive at Nabble.com.
