You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2026/07/06 09:41:01 UTC

[PR] [SPARK-57958][SQL][TESTS] Close the ORC Reader in OrcSourceSuite to fix leaked file streams [spark]

HyukjinKwon opened a new pull request, #57036:
URL: https://github.com/apache/spark/pull/57036

   ### What changes were proposed in this pull request?
   In `OrcSuite.testBloomFilterCreation` and `testSelectiveDictionaryEncoding`, also close the ORC `Reader` (returned by `OrcFile.createReader`) in the `finally` block — previously only the derived `RecordReader` was closed.
   
   ### Why are the changes needed?
   Both helpers do:
   ```scala
   val reader = OrcFile.createReader(orcFilePath, readerOptions)
   var recordReader: RecordReaderImpl = null
   try {
     recordReader = reader.rows.asInstanceOf[RecordReaderImpl]
     ...
   } finally {
     if (recordReader != null) recordReader.close()   // Reader itself is never closed
   }
   ```
   The `Reader` holds the file stream opened in `org.apache.orc.impl.ReaderImpl.extractFileTail`, so it leaks. `SharedSparkSessionBase.afterEach` asserts no open streams (`DebugFilesystem.assertNoOpenStreams`) and aborts the whole suite when the leaked stream is not closed within its wait window:
   
   ```
   org.apache.spark.sql.execution.datasources.orc.OrcSourceV1Suite *** ABORTED ***
     ... There are 1 possibly leaked file streams. (SharedSparkSession.scala:197)
   ```
   The leaked-connection stack (logged by `DebugFilesystem`) points at `org.apache.orc.impl.ReaderImpl.extractFileTail` / `OrcFile.createReader`. This flakes `OrcSourceV1Suite`/`OrcSourceV2Suite` (observed repeatedly on `build_java21` for branch-4.0). Closing the `Reader` fixes the leak.
   
   ### Does this PR introduce _any_ user-facing change?
   No, test-only.
   
   ### How was this patch tested?
   Ran `OrcSourceV1Suite` and `OrcSourceV2Suite` on GitHub Actions.
   
   - **Before (failing on `apache/spark` `build_java21` / branch-4.0):** https://github.com/apache/spark/actions/runs/28766468775/job/85293800991 — `OrcSourceV1Suite *** ABORTED ***`, `There are 1 possibly leaked file streams. (SharedSparkSession.scala:197)`.
   - **After (passing with this change):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28781272553/job/85337180343 — `OrcSourceV1Suite` + `OrcSourceV2Suite`: `Tests: succeeded 72, failed 0`, `All tests passed.` (no leaked-stream abort).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Yes.
   
   This pull request and its description were written by Isaac.


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57958][SQL][TESTS] Close the ORC Reader in OrcSourceSuite to fix leaked file streams [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #57036: [SPARK-57958][SQL][TESTS] Close the ORC Reader in OrcSourceSuite to fix leaked file streams
URL: https://github.com/apache/spark/pull/57036


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57958][SQL][TESTS] Close the ORC Reader in OrcSourceSuite to fix leaked file streams [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #57036:
URL: https://github.com/apache/spark/pull/57036#issuecomment-4891439438

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/9633f932aec024e067238b8df9ef16491bd4df4d
   - merged into branch-4.x https://github.com/apache/spark/commit/00ef6c21b6e7ccb32540158023453aaba64b3eb3
   - merged into branch-4.2 https://github.com/apache/spark/commit/0a4fafe971117a5fb00155417f5ee11fb85fdc22
   - merged into branch-4.1 https://github.com/apache/spark/commit/d0fe0b3507cebcfad4d44d9db05814fbee4c87fd
   - merged into branch-4.0 https://github.com/apache/spark/commit/decdc16ee718fdcf073ee0c1406ebea18f3d57dd
   - merged into branch-3.5 https://github.com/apache/spark/commit/3638f6a29cd49959cd950fbb96227333076beeb6
   
   *Posted by `merge_spark_pr.py`*


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org