[jira] [Comment Edited] (CAMEL-17474) camel-core: deadlock with multicast in a transacted context
[ https://issues.apache.org/jira/browse/CAMEL-17474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17498151#comment-17498151 ] Zheng Feng edited comment on CAMEL-17474 at 2/25/22, 3:21 PM: -- [~jeremyross] [~jondruse] I just found that if adding "transacted()" in route2, it works. {code:java} from("direct:route2").routeId("r.route2") .log(LoggingLevel.DEBUG, "Entering route: ${routeId}") .transacted() .multicast() // 2 or more multicast children will deadlock after the last child .to("log:r.test", "direct:route3") .end(); {code} So it looks like the exchange in the sub-routes is not trancated ? was (Author: zhfeng): [~jeremyross][~jondruse] I just found that if adding "transacted()" in route2, it works. {code:java} from("direct:route2").routeId("r.route2") .log(LoggingLevel.DEBUG, "Entering route: ${routeId}") .transacted() .multicast() // 2 or more multicast children will deadlock after the last child .to("log:r.test", "direct:route3") .end(); {code} > camel-core: deadlock with multicast in a transacted context > --- > > Key: CAMEL-17474 > URL: https://issues.apache.org/jira/browse/CAMEL-17474 > Project: Camel > Issue Type: Bug > Components: camel-core >Affects Versions: 3.13.0, 3.14.0 >Reporter: Jeremy Ross >Assignee: Jiri Ondrusek >Priority: Major > Fix For: 3.14.2, 3.16.0 > > > Using a multicast with more than one child in a transacted context causes a > deadlock. Reproducer here > https://github.com/jeremyross/camel-transacted-multicast. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Comment Edited] (CAMEL-17474) camel-core: deadlock with multicast in a transacted context
[ https://issues.apache.org/jira/browse/CAMEL-17474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17492692#comment-17492692 ] Jiri Ondrusek edited comment on CAMEL-17474 at 2/15/22, 4:09 PM: - [~zhfeng] I have a theory, what could be reason of this error. As you can see here: [https://github.com/apache/camel/blob/main/components/camel-jta/src/main/java/org/apache/camel/jta/TransactionErrorHandler.java#L91] {code:java} @Override public void process(Exchange exchange) throws Exception { // we have to run this synchronously as a JTA Transaction does *not* // support using multiple threads to span a transaction {code} JtaTransactionErrorHandler has to be run synchronously. Unfortunately the change from [https://github.com/apache/camel/commit/961ad0e56e9331e71c386415ec67676e586ea629#diff-592328b1c35a306fa6ba3875f63b872de065e6d973ea89870d579bbab505cfadR214], which replaces "reactiveExecutor.scheduleSync(task);" with "reactiveExecutor.scheduleQueue(task);" changed synchronous executions to asynchronous. With that changed, jta/TransactionErrorHandler does not work correctly. Quick fix is to revert back synchronous behavior, but I'm sure that it is not correct. Do you have an idea how this could be fixed? I see a possibility to define synchronous executions in case that camel-jta transactions are used. I'm ot sure whether it will be p At least this explains why spring transaction works (does not need synchronous executions)... was (Author: jondruse): [~zhfeng] I have a theory, what could be reason of this error. As you can see here: [https://github.com/apache/camel/blob/main/components/camel-jta/src/main/java/org/apache/camel/jta/TransactionErrorHandler.java#L91] {code:java} @Override public void process(Exchange exchange) throws Exception { // we have to run this synchronously as a JTA Transaction does *not* // support using multiple threads to span a transaction {code} JtaTransactionErrorHandler has to be run synchronously. Unfortunately the change from [https://github.com/apache/camel/commit/961ad0e56e9331e71c386415ec67676e586ea629#diff-592328b1c35a306fa6ba3875f63b872de065e6d973ea89870d579bbab505cfadR214], which replaces "reactiveExecutor.scheduleSync(task);" with "reactiveExecutor.scheduleQueue(task);" changed synchronous executions to asynchronous. With that changed, jta/TransactionErrorHandler does not work correctly. Quick fix is to revert back synchronous behavior, but I'm sure that it is not correct. Do you have an idea how this could be fixed? At least this explains why spring transaction works (does not need synchronous executions)... > camel-core: deadlock with multicast in a transacted context > --- > > Key: CAMEL-17474 > URL: https://issues.apache.org/jira/browse/CAMEL-17474 > Project: Camel > Issue Type: Bug > Components: camel-core >Affects Versions: 3.13.0, 3.14.0 >Reporter: Jeremy Ross >Assignee: Jiri Ondrusek >Priority: Major > > Using a multicast with more than one child in a transacted context causes a > deadlock. Reproducer here > https://github.com/jeremyross/camel-transacted-multicast. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Comment Edited] (CAMEL-17474) camel-core: deadlock with multicast in a transacted context
[ https://issues.apache.org/jira/browse/CAMEL-17474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17479137#comment-17479137 ] Jiri Ondrusek edited comment on CAMEL-17474 at 1/20/22, 7:29 AM: - [~jeremyross] You are right, it doesn't help top have different endpoints. (I probably simulated that case with the working camel version - so it showed false success). *But the origin of the reason is still the same as I wrote*. Now I don't think that it is the right behavior. Deadlock is an issue, which shouldn't be there. Following route shouldn't cause deadlock, but it causes. {code} .multicast() .to("log:r.test", "direct:r.test") .end(); {code} was (Author: jondruse): [~jeremyross] You are right, it doesn't help top have different endpoints. (I probably simulated that with working camel version). But the origin of the reason is still the same as I wrote. Bow I don't think that it is the right behavior, it doesn't make sense to deadlock for example {code} .multicast() .to("log:r.test", "direct:r.test") .end(); {code} > camel-core: deadlock with multicast in a transacted context > --- > > Key: CAMEL-17474 > URL: https://issues.apache.org/jira/browse/CAMEL-17474 > Project: Camel > Issue Type: Bug > Components: camel-core >Affects Versions: 3.13.0, 3.14.0 >Reporter: Jeremy Ross >Assignee: Jiri Ondrusek >Priority: Major > > Using a multicast with more than one child in a transacted context causes a > deadlock. Reproducer here > https://github.com/jeremyross/camel-transacted-multicast. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Comment Edited] (CAMEL-17474) camel-core: deadlock with multicast in a transacted context
[ https://issues.apache.org/jira/browse/CAMEL-17474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17474745#comment-17474745 ] Jeremy Ross edited comment on CAMEL-17474 at 1/12/22, 5:34 PM: --- Looks like this was introduced in 3.13.0. was (Author: jeremyross): Looks like this was introduced in 3.14.0. > camel-core: deadlock with multicast in a transacted context > --- > > Key: CAMEL-17474 > URL: https://issues.apache.org/jira/browse/CAMEL-17474 > Project: Camel > Issue Type: Bug > Components: camel-core >Affects Versions: 3.14.0 >Reporter: Jeremy Ross >Priority: Major > > Using a multicast with more than one child in a transacted context causes a > deadlock. Reproducer here > https://github.com/jeremyross/camel-transacted-multicast. -- This message was sent by Atlassian Jira (v8.20.1#820001)