Repository navigation
Conversation
10 tasks
GravitinoEnv is a JVM-wide singleton, and shutdown() closed its components but kept the references. A later initialization or test in the same JVM then saw closed components (MetricsSystem) or doubles an earlier test injected (authorizer, internal access control dispatcher), which caused the order-dependent failures fixed test-side in apache#14099, apache#14100 and apache#14102.
nevzheng
force-pushed
the
claude/14148-gravitinoenv-shutdown-reset
branch
from
October 26, 2026 16:16
38e155e to
9be3e1f
Compare
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.
Requested by Nevin
What changes were proposed in this pull request?
shutdown()now ends withclearComponents(), which sets every component field back toits initial value after closing them.
TestGravitinoEnvShutdownchecks that an injected authorizer, internal accesscontrol dispatcher and metrics system are gone after
shutdown(). The KMS and secret registrytests now expect their getters to throw after shutdown instead of returning the closed instance.
Why are the changes needed?
A closed component left in the singleton leaks into whatever runs next in the JVM. The test-side
fixes in #14099, #14100 and #14102 work around three symptoms; this removes the cause.
Fix: #14148
Does this PR introduce any user-facing change?
No. After
shutdown(), getters return null or throw instead of returning closed components.GravitinoServer.stop()callsshutdown()after the HTTP server stops, so no request sees thecleared state.
How was this patch tested?
./gradlew :core:spotlessCheck :core:test --tests 'org.apache.gravitino.TestGravitinoEnv*' -PskipITspasses: 10 tests inTestGravitinoEnvShutdown,TestGravitinoEnvKmsClientRegistry,TestGravitinoEnvSecretProviderRegistryandTestGravitinoEnvMetadataComponents, no failures.