KAFKA-17932: Avoid shutdown deadlock after metadata faults - #23046
Open
lh0156 wants to merge 1 commit into
Open
Conversation
Do not acquire the SharedServer monitor from the metadata loader fault action. Shutdown holds this monitor while joining the metadata loader event thread, so acquiring it from that thread can deadlock. Add a regression test that holds the monitor while invoking the action. Generated-by: OpenAI Codex (GPT-5) Signed-off-by: Yunseop Eom <62834176+lh0156@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes KAFKA-17932
Summary
SharedServermonitor from the metadata loader fault action.SharedServerholds the monitor and waits for the metadata loader event thread.The metadata loader event handler can invoke the fault action after a metadata loading failure. Shutdown synchronizes on
SharedServerand 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 theSharedServermonitor.Tests
./gradlew :core:test --tests kafka.server.SharedServerTest --no-build-cache --console=plain./gradlew :core:spotlessCheck --no-build-cache --console=plaingit diff --checkThe regression test was verified to fail on the base branch with a timeout, then pass after removing the unnecessary monitor acquisition.