[ZEPPELIN-6256] Fix resource leaks in SparkInterpreterLauncher.detectSparkScalaVersion#4996
Closed
renechoi wants to merge 5 commits into
Closed
Conversation
- Add comprehensive input validation for Repository ID, URL, credentials, and proxy settings - Introduce RepositoryException for better error handling and clear error messages - Enhance JSON deserialization with proper exception handling and validation - Add extensive test coverage with 21 test cases covering all validation scenarios - Improve JavaDoc documentation with usage examples and exception conditions - Maintain backward compatibility while strengthening internal validation
…itory class - Made all Repository class variables final for immutability - Implemented Builder pattern as requested by reviewer - Deprecated existing fluent API methods in favor of Builder - Updated factory methods to use Builder pattern - Maintained backward compatibility with @deprecated annotations - Updated javadoc examples to demonstrate Builder usage The Builder pattern provides better control over object construction and ensures immutability of Repository instances once created.
- Updated all Repository instantiation in tests to use the new builder pattern - Fixed compilation errors in RepositoryTest.java and InterpreterInfoSavingTest.java - Replaced direct constructor calls with Repository.Builder pattern - All tests now use .build() method to create Repository instances - Maintained test logic and coverage while adopting the new pattern
…SparkScalaVersion
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.
What is this PR for?
This PR fixes resource leaks in the
detectSparkScalaVersionmethod ofSparkInterpreterLauncher.java:These leaks could destabilize Zeppelin over time, especially with frequent interpreter restarts.
What type of PR is it?
Bug Fix
Todos
What is the Jira issue?
How should this be tested?
Unit tests added:
testDetectSparkScalaVersionResourceCleanup: Verifies that FileInputStream is closed and temporary file is deleted after successful executiontestDetectSparkScalaVersionMultipleCalls: Ensures no resource accumulation after multiple method invocationsManual testing:
zeppelin-spark*.outfiles remainCI: All existing tests pass
Screenshots (if appropriate)
N/A
Questions:
Implementation Details
Code Changes
detectSparkScalaVersionmethod to properly manage resources