[
https://issues.apache.org/jira/browse/CAMEL-19487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Palaga updated CAMEL-19487:
---------------------------------
Description:
This is actually reopening CAMEL-9311, because DynamicRouterConcurrentPOJOTest
that was added to reproduce it is still failing.
First I thought the test is just flaky due to its bad design: it was calling
{{assertMockEndpointsSatisfied()}} without any synchronizations of the
participating threads.
But fixing that by adding
{code}
sendToSedaA.join(10000);
sendToSedaB.join(10000);
{code}
and replacing {{assertMockEndpointsSatisfied()}} with some timeouted variant
did not make the issue disappear.
The improved reproducer test can be seen in this branch:
https://github.com/ppalaga/camel/commits/CAMEL-19487
Note that it is not always failing. On my machine, I see it failing like 1:10.
Invoking it in a loop eventually leads to a failure:
{code}
git fetch [email protected]:ppalaga/camel.git CAMEL-19487
git checkout -b CAMEL-19487 FETCH_HEAD
# rebuild the tree
mvnd clean install -Pfastinstall
cd core/camel-core
set -e; while true; do mvnd test
-Dtest=DynamicRouterConcurrentPOJOTest#testConcurrentDynamicRouter; done
{code}
The second commit https://github.com/ppalaga/camel/commits/CAMEL-19487 adds
some debug output.
In case of failure it shows that one of the dynamic router instances sometimes
sends one or more messages to the wrong endpoint.
Here is an example:
{code}
[INFO] Running
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
...
[INFO] [stdout] ==== pipe a before Message from seda:a 74
...
[INFO] [stdout] ======= adding to mock:b: Message from seda:a 74
...
[INFO] [stdout] ==== pipe a after Message from seda:a 74 cnt 74
...
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.328 s
<<< FAILURE! -- in
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
[ERROR]
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest.testConcurrentDynamicRouter
-- Time elapsed: 0.317 s <<< FAILURE!
java.lang.AssertionError:
[Expected mock:b to contain only messages from seda:b, but there were also
messages from seda:a]
Expecting empty but was: ["Message from seda:a 74"]
{code}
In this case the dynamic router instance attached to route a sends the message
to mock:b.
I'd say that's a serious bug.
This is exactly what the original issue CAMEL-9311 was about.
Observation:
The issue does not occur when each route uses a different dynamic router type:
when I copy MyDynamicRouterPojo as MyDynamicRouterPojoB and use it in the route
b, then all works as expected.
was:
This is actually reopening CAMEL-9311, because DynamicRouterConcurrentPOJOTest
that was added to reproduce it is still failing.
First I thought the test is just flaky due to its bad design: it was calling
{{assertMockEndpointsSatisfied()}} without any synchronizations of the
participating threads.
But fixing that by adding
{code}
sendToSedaA.join(10000);
sendToSedaB.join(10000);
{code}
and replacing {{assertMockEndpointsSatisfied()}} with some timeouted variant
did not make the issue disappear.
The improved reproducer test can be seen in this branch:
https://github.com/ppalaga/camel/commits/CAMEL-19487
Note that it is not always failing. On my machine, I see it failing like 1:10.
Invoking it in a loop eventually leads to a failure:
{code}
git fetch CAMEL-19487 [email protected]:ppalaga/camel.git
git checkout -b CAMEL-19487 FETCH_HEAD
# rebuild the tree
mvnd clean install -Pfastinstall
cd core/camel-core
set -e; while true; do mvnd test
-Dtest=DynamicRouterConcurrentPOJOTest#testConcurrentDynamicRouter; done
{code}
The second commit https://github.com/ppalaga/camel/commits/CAMEL-19487 adds
some debug output.
In case of failure it shows that one of the dynamic router instances sometimes
sends one or more messages to the wrong endpoint.
Here is an example:
{code}
[INFO] Running
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
...
[INFO] [stdout] ==== pipe a before Message from seda:a 74
...
[INFO] [stdout] ======= adding to mock:b: Message from seda:a 74
...
[INFO] [stdout] ==== pipe a after Message from seda:a 74 cnt 74
...
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.328 s
<<< FAILURE! -- in
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
[ERROR]
org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest.testConcurrentDynamicRouter
-- Time elapsed: 0.317 s <<< FAILURE!
java.lang.AssertionError:
[Expected mock:b to contain only messages from seda:b, but there were also
messages from seda:a]
Expecting empty but was: ["Message from seda:a 74"]
{code}
In this case the dynamic router instance attached to route a sends the message
to mock:b.
I'd say that's a serious bug.
This is exactly what the original issue CAMEL-9311 was about.
Observation:
The issue does not occur when each route uses a different dynamic router type:
when I copy MyDynamicRouterPojo as MyDynamicRouterPojoB and use it in the route
b, then all works as expected.
> Dynamic router instances pass messages to wrong endpoints
> ---------------------------------------------------------
>
> Key: CAMEL-19487
> URL: https://issues.apache.org/jira/browse/CAMEL-19487
> Project: Camel
> Issue Type: Bug
> Components: core
> Affects Versions: 4.0-M3
> Reporter: Peter Palaga
> Priority: Minor
>
> This is actually reopening CAMEL-9311, because
> DynamicRouterConcurrentPOJOTest that was added to reproduce it is still
> failing.
> First I thought the test is just flaky due to its bad design: it was calling
> {{assertMockEndpointsSatisfied()}} without any synchronizations of the
> participating threads.
> But fixing that by adding
> {code}
> sendToSedaA.join(10000);
> sendToSedaB.join(10000);
> {code}
> and replacing {{assertMockEndpointsSatisfied()}} with some timeouted variant
> did not make the issue disappear.
> The improved reproducer test can be seen in this branch:
> https://github.com/ppalaga/camel/commits/CAMEL-19487
> Note that it is not always failing. On my machine, I see it failing like
> 1:10. Invoking it in a loop eventually leads to a failure:
> {code}
> git fetch [email protected]:ppalaga/camel.git CAMEL-19487
> git checkout -b CAMEL-19487 FETCH_HEAD
> # rebuild the tree
> mvnd clean install -Pfastinstall
> cd core/camel-core
> set -e; while true; do mvnd test
> -Dtest=DynamicRouterConcurrentPOJOTest#testConcurrentDynamicRouter; done
> {code}
> The second commit https://github.com/ppalaga/camel/commits/CAMEL-19487 adds
> some debug output.
> In case of failure it shows that one of the dynamic router instances
> sometimes sends one or more messages to the wrong endpoint.
> Here is an example:
> {code}
> [INFO] Running
> org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
> ...
> [INFO] [stdout] ==== pipe a before Message from seda:a 74
> ...
> [INFO] [stdout] ======= adding to mock:b: Message from seda:a 74
> ...
> [INFO] [stdout] ==== pipe a after Message from seda:a 74 cnt 74
> ...
> [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.328
> s <<< FAILURE! -- in
> org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest
> [ERROR]
> org.apache.camel.processor.dynamicrouter.DynamicRouterConcurrentPOJOTest.testConcurrentDynamicRouter
> -- Time elapsed: 0.317 s <<< FAILURE!
> java.lang.AssertionError:
> [Expected mock:b to contain only messages from seda:b, but there were also
> messages from seda:a]
> Expecting empty but was: ["Message from seda:a 74"]
> {code}
> In this case the dynamic router instance attached to route a sends the
> message to mock:b.
> I'd say that's a serious bug.
> This is exactly what the original issue CAMEL-9311 was about.
> Observation:
> The issue does not occur when each route uses a different dynamic router
> type: when I copy MyDynamicRouterPojo as MyDynamicRouterPojoB and use it in
> the route b, then all works as expected.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)