allthingssecurity commented on PR #26797: URL: https://github.com/apache/camel/pull/26797#issuecomment-5805979582
@oscerd thanks for catching this. The failure was a race in the test, not in the fix. `suspendRoute` only changes the consumer state; it doesn't interrupt a `queue.poll(pollTimeout)` that is already running. When the test sent A right after suspending, a poll that started before the suspension could still return A and process it (`Expected: <0> but was: <1>`). That is existing SEDA behaviour: a suspension takes effect at the consumer's next loop, at most one `pollTimeout` later. This PR doesn't change that. 57daca6c8 makes the test deterministic. The consumer thread is kept busy processing a message X, held by a latch, while the consumer is suspended. That is how a `RoutePolicy` such as `ThrottlingInflightRoutePolicy` suspends it. A, B and C are then queued, and X is released. The consumer finds itself suspended before its next poll, so A/B/C stay on the queue. `stopRoute(..., 10s, abortAfterTimeout=true)` now returns `true` without a timeout, and A/B/C are processed after `startRoute`. Both tests pass 3/3 locally, and both fail without the fix: `Route should be stopped without waiting for the shutdown timeout ==> expected: <true> but was: <false>` and `Graceful shutdown should not time out`. About `StopRouteAbortAfterTimeoutTest`: I don't think it's related. A graceful stop doesn't suspend SEDA consumers (`SedaConsumer.deferShutdown()` returns `true`), so they keep draining the queue, and the new code only applies to a consumer that was already suspended. That test depends on its 5 × 100 ms messages still being pending at the shutdown strategy's 1 s check. In that CI run it passed on the surefire retry (counted as a flake), and it passes 3/3 locally with this change (rerun disabled). `Seda*`, `*Suspend*`, `StopRoute*` and `*GracefulShutdown*`: 130 tests, 0 failures. _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]
