Repository navigation
Conversation
Signed-off-by: xinjun.jiang <xinjun.jiang@daocloud.io>
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.
Describe what this PR does / why we need it
FileInJarReadableDataSource.close()clears the buffer but leaves the ownedJarFileopen. Explicitly closing a data source therefore retains its file descriptor until the JAR is otherwise cleaned up.Does this pull request fix one issue?
Fixes #3660
Describe how you did it
Close the owned
JarFilebefore releasing the read buffer.Describe how to verify it
Regression tests verify that the real JAR handle is closed after successful loading and after an initial parser failure, and that repeated closes are safe. Both tests fail before the fix and pass afterward.
A Linux JVM integration reproduction creates and closes 20 separate JAR data sources while retaining their objects. The unmodified implementation keeps 20 JAR file descriptors open; the patch keeps none open.
Validation on JDK 17:
mvn -B -pl sentinel-extension/sentinel-datasource-extension -am test -Dtest=FileInJarReadableDataSourceCloseTest -Dsurefire.failIfNoSpecifiedTests=false mvn -B -pl sentinel-extension/sentinel-datasource-extension -am install -DskipTests=true -Dmaven.javadoc.skip=true -DminimumPriority=1The matching module build, including the configured PMD check, also passes.
Special notes for reviews