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 2008/11/25 13:33:06 UTC

[jira] Created: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
-----------------------------------------------------------------------------------------

                 Key: SM-1702
                 URL: https://issues.apache.org/activemq/browse/SM-1702
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-cxf-bc
    Affects Versions: 3.3, 3.2.3, servicemix-cxf-bc-2008.01
            Reporter: Freeman Fang
            Assignee: Freeman Fang
             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4


should use
                    synchronized (context.getDeliveryChannel()) {
                        context.getDeliveryChannel().sendSync(exchange,
                            timeout * 1000);
                    }
to send out jbi message in sync case

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


[jira] Commented: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47606#action_47606 ] 

Guillaume Nodet commented on SM-1702:
-------------------------------------

The delivery channel is thread safe, so there is no need for a lock here.

> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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


[jira] Commented: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47619#action_47619 ] 

Freeman Fang commented on SM-1702:
----------------------------------

Hi Guillaume,

You are correct, the delivery channel is thread safe and no need to add synchronized block here.

I try to explain more about my scenario.
Actually I try to fix a cocurrent issue.
The flow is
multiple external client ===> cxf bc consumer(sendSync) ====> cxf bc se
The error is that cxf bc consumer get response message with status ERROR but getFault() == null if multiple external invocation  come in at same time
As we chat yesterday, you said this could be caused by the timeout of sendSync, yes, I verify that is the case.
Moreover, after debug into the code, I found that the timeout is caused by cxf se  used up its default thread (the default corePoolSize is 4 for cxf se component), so if there are more than 4  sync invocation coming to cxf se, cxf se will hang on sendSync(where try to send back response, but there is no more thread in cxf se for doRouting since all 4 threads is block on waiting, and the task for Flow.doRouting() is in the queue now, that means the sendSync() of cxf se blocked for wait() but no thread to notify them), hence cause the timeout on cxf bc side.



The solution is 
1. add synchronous="false" for cxf bc consumer endpoint, so that the cxf bc and cxf se will use send() (non thread block),  the asynchronized invocation is more suitable for the cocurrency.
2. when use synchronous way, ensure that the incoming messsage for cxf se isn't more than the corePoolSize, so that there is still thread left for doRouting, we can 
configure the jetty thread pool in cxf bc consumer and executorFactory in cxf se to guarantee it (the jetty thread pool size for cxf bc consumer should less then the corePoolSize for cxf se).
I will remove the lock for DeliveryChannel and modify test to show how to configure cxf bc/se to use synchronous way when handle concurrenct invocation.

Thanks 
Freeman



> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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


[jira] Work started: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on SM-1702 started by Freeman Fang.

> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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


[jira] Resolved: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved SM-1702.
------------------------------

    Resolution: Working as Designed

revert changes
http://svn.apache.org/viewvc?rev=720747&view=rev

> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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


[jira] Commented: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47736#action_47736 ] 

Freeman Fang commented on SM-1702:
----------------------------------

commit fix
http://svn.apache.org/viewvc?rev=722015&view=rev for servicemix-cxf-bc component project

> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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


[jira] Commented: (SM-1702) need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47605#action_47605 ] 

Freeman Fang commented on SM-1702:
----------------------------------

commit fix
http://svn.apache.org/viewvc?rev=720485&view=rev for 3.2 branch

> need add lock for DeliveryChannel of cxf bc consumer to handle multiple client invocation
> -----------------------------------------------------------------------------------------
>
>                 Key: SM-1702
>                 URL: https://issues.apache.org/activemq/browse/SM-1702
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: servicemix-cxf-bc-2008.01, 3.2.3, 3.3
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: servicemix-cxf-bc-2008.02, 3.3.1, 3.2.4
>
>
> should use
>                     synchronized (context.getDeliveryChannel()) {
>                         context.getDeliveryChannel().sendSync(exchange,
>                             timeout * 1000);
>                     }
> to send out jbi message in sync case

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