cziegeler opened a new pull request, #53:
URL: https://github.com/apache/sling-org-apache-sling-event/pull/53

   ## Problem
   
   A concurrency review identified a lock-order inversion (ABBA deadlock) 
between two locks in the job processing path:
   
   - **Thread A** (OSGi unbind): `synchronized(topicToConsumerMap)` → 
`asyncProcessingFinished()` → `finishedJob()` → `reschedule()` → `requeue()` → 
`cache.reschedule()` → `synchronized(cache)`
   - **Thread B** (startJobs): `synchronized(cache)` (inside `getNextJob()`) → 
`jobConsumerManager.getExecutor()` → `synchronized(topicToConsumerMap)`
   
   With retry delay <= 0, the requeue path is synchronous and the deadlock is 
reachable in production. This can cause a complete system freeze.
   
   ## Fix
   
   Move `asyncProcessingFinished()` callbacks outside 
`synchronized(topicToConsumerMap)` in `unbindService()`. Callbacks are 
collected into a local list while holding the lock, then invoked after 
releasing it. This breaks the `topicToConsumerMap → cache` path while 
preserving the existing `cache → topicToConsumerMap` path unchanged.
   
   ## Testing
   
   - `mvn test` — all existing unit tests pass
   - The fix is a minimal, targeted change to callback invocation ordering


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