renechoi opened a new pull request, #4996: URL: https://github.com/apache/zeppelin/pull/4996
### What is this PR for? This PR fixes resource leaks in the `detectSparkScalaVersion` method of `SparkInterpreterLauncher.java`: 1. **Unclosed FileInputStream**: The FileInputStream created to read the process output was never closed, leading to file descriptor leaks 2. **Undeleted temporary file**: The temporary file created to capture spark-submit output was never deleted, causing disk space accumulation These leaks could destabilize Zeppelin over time, especially with frequent interpreter restarts. ### What type of PR is it? Bug Fix ### Todos * [ ] - Code review * [ ] - CI build verification ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-6256 ### How should this be tested? * **Unit tests added**: - `testDetectSparkScalaVersionResourceCleanup`: Verifies that FileInputStream is closed and temporary file is deleted after successful execution - `testDetectSparkScalaVersionMultipleCalls`: Ensures no resource accumulation after multiple method invocations * **Manual testing**: - Start Zeppelin with Spark interpreter - Monitor temp directory before/after interpreter restart - Verify no `zeppelin-spark*.out` files remain * **CI**: All existing tests pass ### Screenshots (if appropriate) N/A ### Questions: * Does the license files need to update? **No** * Is there breaking changes for older versions? **No** * Does this needs documentation? **No** ### Implementation Details - Used try-with-resources to ensure FileInputStream is properly closed - Added finally block to guarantee temporary file deletion - Added warning log when file deletion fails for debugging - Maintained backward compatibility - no API changes ### Code Changes - Modified `detectSparkScalaVersion` method to properly manage resources - Added comprehensive unit tests for resource cleanup verification -- 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: reviews-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org