allthingssecurity commented on PR #28812:
URL: https://github.com/apache/camel/pull/28812#issuecomment-6567013394
Thanks @gnodet-bot, both points are addressed in 7bcc51dc7799.
**Context stop while `act()` runs (`ChaosLifecycle.java:513`).** You're
right that `act()` had no explicit check. `scheduleComeback` now first checks
whether the CamelContext is stopping. If it is, it cancels the fault with the
reason "the CamelContext is stopping, so route X was not started" (shown as
`cancelled: ...` in the report). The comment now describes the real path:
`shutdownNow` interrupts the task, but the route operation can still finish
first, and then `scheduleComeback` cancels the fault.
New test `ChaosLifecycleTest.aContextStopWhileTheRuleActsCancelsTheFault`.
It waits until the Chaos thread is inside `DefaultShutdownStrategy` (the stop
of a route with an exchange in flight held by a latch), then stops the context
on another thread and releases the latch. The context stop completes, the fault
ends `cancelled`, the route is not started again, and no Chaos thread is left.
No sleeps. As you noted, the code without the guard also ended this case
cancelled, through `executorIfStarted()` returning null. So without the guard
the test fails only on the reason ("the context stopped, ..."). The test pins
the behaviour, and the guard makes the intent explicit.
**Lock-order Javadoc (`ChaosLifecycle.java:66`).** Added to the class
Javadoc. One correction: the suggested sentence had the order reversed. In the
code a `Fault`'s lock is the outer one: `scheduleAct`/`scheduleComeback` run
under the Fault's lock and call the synchronized `track`/`executorIfStarted` of
`ChaosLifecycle`. `ChaosLifecycle` never takes a Fault's lock while holding its
own (`contextStopping` copies the faults and releases its lock first). So the
note says: "Lock ordering: a Fault's lock is taken first and this class's lock
inside it, never the other way round." This matches the `Fault` Javadoc.
camel-chaos module tests pass (304). `ChaosLifecycleTest` 20 times in one
JVM: 400/400.
_Claude Code on behalf of allthingssecurity_
--
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]