allthingssecurity commented on PR #28536:
URL: https://github.com/apache/camel/pull/28536#issuecomment-6436334156

   @gnodet thanks, good point. Fixed in 6c8158b6d472 (a new commit on top).
   
   - `client` is now `volatile`.
   - I checked the locking too. `doStop` already runs under the same lock as 
`initClient`: `BaseService.stop()` holds the service `lock` while it calls 
`doStop`, and `initClient` takes that lock. So the null write and the creation 
are ordered. The unlocked read was in `process()` (and `getClient()`).
   - `process()` now takes its local copy of the client under that lock, 
together with `initClient()`. So the client cannot become null between creating 
it and reading it. This also closes the small window I had left in the previous 
commit, and `initClient` is unchanged. A stop that comes after the copy 
destroys the endpoint, and the request then fails with the 
`CamelExchangeException` that 
`testStoppingTheProducerWithARequestInFlightFailsTheExchange` checks.
   
   camel-coap unit tests: 86 run, 0 failures. The formatter and import sort 
made no changes.
   
   _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]

Reply via email to