Croway commented on PR #30093:
URL: https://github.com/apache/camel/pull/30093#issuecomment-6899440877

   Thanks for the reviews. Changes in 75f6405:
   
   **1. Cut the upload only when the shutdown is forced** (davsclaus): done, 
with one difference from the snippet: `disconnectOnStop()` waits for the lock 
as before as long as `isForceShutdown()` is false, and checks the flag again 
every second while it waits, instead of once.
   
   - When the CamelContext stops a route whose consumer is deferred or 
suspended (direct, seda, JMS, ...), the producer is stopped after the timeout, 
by the thread that set `forceShutdown`: a single check works there (the two 
first ITs pass with it).
   - But a graceful shutdown stops a consumer that cannot be suspended (such as 
netty's) right away, and `DefaultConsumer.doStop()` stops the processors of its 
route with it: the stop of the producer begins in the `ShutdownTask` thread 
before the timeout, while the upload runs. With a single check it waited for a 
hung upload without bound, and `CamelContext.stop()` hung as on `main`: the 
forced shutdown then blocks in `shutdownNow(consumer)` on the lock of that 
consumer, which the shutdown task is still stopping. The new IT 
`stopDoesNotWaitForUploadOfRouteWhoseConsumerStopsRightAway` fails with the 
single check (`stop()` still blocked after 20 s) and passes with the check 
repeated. The shutdown task is interrupted when the shutdown times out, just 
before `forceShutdown` is set, so the interrupt does not end the wait; it is 
restored at the end.
   - Your point also covered a regression of 51e5dab in that same case: a 
graceful shutdown cut a healthy upload after 1 s, long before its timeout (new 
IT `gracefulStopWaitsForUploadOfRouteWhoseConsumerStopsRightAway`, 30 s 
timeout: failed on 51e5dab, passes now).
   - `ProducerTemplate.stop()` while another thread uploads with it waits for 
the upload again (new IT `stopOutsideForcedShutdownWaitsForUpload`: failed on 
51e5dab, passes now). The eviction of a `toD` producer goes through the same 
`stop()`.
   - Not covered, as before the PR: `stopRoute(id, timeout, unit)` does not set 
`forceShutdown` when it times out, so a hung upload in that route still blocks 
the route stop.
   - The WARN is logged only once the shutdown is forced, and says so. No docs 
or upgrade-guide change: outside a forced shutdown nothing changes for users.
   
   **2. `<p/>` → `<p>`** (gnodet-bot): done, both, in the reworded Javadoc of 
`RemoteFileOperations.disconnectOnStop()`.
   
   The PR description is updated, with the results of each IT on `main`, 
51e5dab, a single check, and this commit.
   
   _Claude Code on behalf of Croway_
   


-- 
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