apupier opened a new pull request, #30497:
URL: https://github.com/apache/camel/pull/30497

   # Description
   
   [CAMEL-25488](https://issues.apache.org/jira/browse/CAMEL-25488): 
`JGroupsRaftProducerTest` still fails rarely on CI with `AssertionFailedError: 
expected: not <null>` in `JGroupsRaftAbstractTest.checkHeaders`.
   
   The real error is in the log: `RaftLeaderException: there is currently no 
leader to forward set() request to`. `waitForLeader()` returned because every 
node knew the leader, but the leader was lost again (or not settled yet, for 
instance a view change giving `leader_lost`) before the request reached 
`set()`. The producer rightly fails the exchange, and a failed exchange has no 
Raft headers, hence the null header in `checkHeaders`.
   
   Only the tests change (the producer is right to fail fast without a leader):
   - `JGroupsRaftAbstractTest.requestWhenLeaderKnown()` sends the request again 
every 200 ms, for up to 30 seconds, until the exchange has no exception, and 
reports the last exception when it gives up.
   - `JGroupsRaftProducerTest` and `JGroupsRaftRemoveRouteTest` use it for the 
requests that must succeed. `JGroupsRaftProducerBodyTest` is unchanged, it 
expects failures.
   
   ## Reproduction
   
   The failure did not happen locally by repeating the test under CPU load (48 
runs, 60 and 400 repetitions in one JVM). It was reproduced by clearing the 
leader of node C right after `waitForLeader()` returned and restoring it 500 ms 
later: without this change the test fails with the same two errors, with it the 
test passes. This shows the change handles the failing state, not that the 
leader loss on CI happens this way.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   ---
   _IBM Bob 2.2.1 on behalf of apupier (AI-generated)_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to