Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46B8F9E29 for ; Thu, 26 Jul 2012 02:43:06 +0000 (UTC) Received: (qmail 86321 invoked by uid 500); 26 Jul 2012 02:43:05 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 86288 invoked by uid 500); 26 Jul 2012 02:43:05 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 86272 invoked by uid 99); 26 Jul 2012 02:43:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2012 02:43:05 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of willem.jiang@gmail.com designates 209.85.214.45 as permitted sender) Received: from [209.85.214.45] (HELO mail-bk0-f45.google.com) (209.85.214.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2012 02:43:00 +0000 Received: by bkcji1 with SMTP id ji1so849510bkc.32 for ; Wed, 25 Jul 2012 19:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=PSkwmho1TrD51oiGrB8csZaZRwGASUQmAcWwm18UoiI=; b=SW82XW5m3y/9O7SZpyWPJs/2LLE7jh/piR41e4lLen5+OhzdnqAV3oymkA88L4QhsS wI9pDT1hR2ugox9Qcn+vgEu7mUkF7rzgMLyqBsrLFkSXYxK7fMMTWnd8a1W17RVJ71sQ Wwgojdd43vO0yNEv8NpMYO/jQ4poQI3MUqd4hXy+uZIqd1SJIoPW72nGSO/ie3SSF9yR Rd0ljhqmc6Y2ikt7Jpe8vICHP7MOjoplANKOPGtpxIxeLes/CSsEAXoM8SGfaF/UIhxY 6B6JLOhuyr4HCqmkU7rtOLnlrWJZ0veK1rxKab4Gr/Sb0dJIBTQjkRGsN6s75QId3YsQ GvTg== MIME-Version: 1.0 Received: by 10.205.126.15 with SMTP id gu15mr12642866bkc.134.1343270558723; Wed, 25 Jul 2012 19:42:38 -0700 (PDT) Received: by 10.204.231.194 with HTTP; Wed, 25 Jul 2012 19:42:38 -0700 (PDT) In-Reply-To: References: <1343061502860-5716351.post@n5.nabble.com> <500DCD37.2080809@gmail.com> <500FF829.2080407@gmail.com> <501021A3.6000600@gmail.com> Date: Thu, 26 Jul 2012 10:42:38 +0800 Message-ID: Subject: Re: CxfRsProducer is not thread safe From: Willem Jiang To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Dumitru do you mind to create a JIRA[1] here. It will be helpful for us to trace the issue. [1]https://issues.apache.org/jira/browse/CAMEL Willem On Thu, Jul 26, 2012 at 2:55 AM, dumi_p wrote: > 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 2= 0 > percent of the requests. > > Best regards, > /Dumitru > > On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] < > ml-node+s465427n5716473h84@n5.nabble.com> 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]>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 >> >>>> stacktrace.txt >> >>>> >> >>>> I tried following things in class >> >>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix i= t: >> >>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no >> >>>> success >> >>>> 2. Added synchronization point over line WebClient client =3D >> >>>> 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 inf= o >> 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 wan= t >> 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 o= f >> >>> 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-**RSClientAP= I- >> >>> **ConfiguringHTTPclientsinSpring< >> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Config= uringHTTPclientsinSpring> >> >> >>> >> >>> [2] >> >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAP= I- >> >>> **ConfiguringproxiesinSpring< >> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Config= uringproxiesinSpring> >> >> >>> >> >>> [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-tp571= 6351.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 discussio= n >> below: >> >> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp571= 6351p5716473.html >> To unsubscribe from CxfRsProducer is not thread safe, click here >> . >> NAML >> > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/CxfRsProd= ucer-is-not-thread-safe-tp5716351p5716475.html > Sent from the Camel - Users mailing list archive at Nabble.com.