lh0156 opened a new pull request, #23046:
URL: https://github.com/apache/kafka/pull/23046

   Closes KAFKA-17932
   
   ### Summary
   
   - Avoid taking the `SharedServer` monitor from the metadata loader fault 
action.
   - Prevent shutdown from deadlocking while `SharedServer` holds the monitor 
and waits for the metadata loader event thread.
   - Add a regression test that reproduces the lock-ordering failure and 
verifies the action completes while the monitor is held.
   
   The metadata loader event handler can invoke the fault action after a 
metadata loading failure. Shutdown synchronizes on `SharedServer` and then 
joins the metadata loader event thread. The previous synchronized fault action 
inverted that order and could block both threads indefinitely. The metrics 
fields are volatile and the snapshot disable reason uses an atomic reference, 
so the action does not need the `SharedServer` monitor.
   
   ### Tests
   
   - `./gradlew :core:test --tests kafka.server.SharedServerTest 
--no-build-cache --console=plain`
   - `./gradlew :core:spotlessCheck --no-build-cache --console=plain`
   - `git diff --check`
   
   The regression test was verified to fail on the base branch with a timeout, 
then pass after removing the unnecessary monitor acquisition.
   


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