You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2006/08/07 18:27:23 UTC

[jira] Commented: (SM-512) sendsync from a service to another service seems to cause a deadlock under load

    [ https://issues.apache.org/activemq/browse/SM-512?page=comments#action_36698 ] 
            
Guillaume Nodet commented on SM-512:
------------------------------------

I' ve been thinking about that a bit.
The main problem is that as soon as components use sendSync, this can lead to deadlocks, unless
you have an unbounded number of threads.

Let' s take the worst possible example.  We have a component that implements the factorial of an integer using
recursive sendSync.  The number of threads needed for this very component is unbounded.  Of course, I hope that
nobody will ever implement it that way.

So, in your case, you have a jms queue with thousands of pending messages, but I think this is the same problem.
The jms component will use its thread pool to process incoming jms messages.  If you have more jms messages
than threads, each thread of the pool will be used to process one jms message.  If the jms component use
sendSync, and if the exchange ever need to come back to the jms component, there will be a deadlock.

I really don't see any solutions here, other than using asynchonous send, or an unbounded thread pool.
The workaround is to use throttling, as defined in the jmx mbeans for the component.

We need a way to easily configure all these parameters (queue capacity for seda / delivery channel, thread pool, throttling).




> sendsync from a service to another service seems to cause a deadlock under load
> -------------------------------------------------------------------------------
>
>                 Key: SM-512
>                 URL: https://issues.apache.org/activemq/browse/SM-512
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: 3.0-M2
>         Environment: Windows 2003, Intel 2.8 xeon processor. Java 1.5 3.0-M2
>            Reporter: anand somani
>             Fix For: 3.0-M3
>
>         Attachments: test.zip
>
>
> We have 2 services A and B. A makes sync requests to B. We have a JMS client that feeds requests to A and that triggers a sync request to B. We are trying to push some 5000 requests (not sequential). Now
>      With st flow - A gets all the responses from B and we are good
>      with Seda flow -  A gets some responses from B (sometimes none) and then all the threads are blocked (seen using JMX) on syncsend(), looks like B has no threads to service requests.
>      with JMS flow ( A and B on different VMs), we see the similar behavior as with seda flow
> With async requests everything works just fine. We have tried increasing seda capacity and workmanager thread count, that did not help.  I am attaching service A and B code along with configuration files
> Also it would be nice to have all the tunable features documented with some explaination somewhere ( I could not find it anywhere)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira