thswlsqls opened a new issue, #8765:
URL: https://github.com/apache/paimon/issues/8765

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   **Paimon version**
   master @ 345526e26
   
   **Compute Engine**
   Engine-agnostic (core)
   
   **Minimal reproduce step**
   Call `FileIndexFormat.createReader(seekableInputStream, rowType)` on a 
corrupt or wrong-version index file. `FileIndexFormat.Reader.<init>` 
(paimon-common `FileIndexFormat.java` lines 248-261) throws a 
`RuntimeException` from the magic check ("This file is not file index file.") 
or the version check, both inside the constructor's `try` block. The only 
`catch (IOException e)` (line 282) closes the owned stream, but a 
`RuntimeException` escapes it uncaught.
   
   **What doesn't meet your expectations?**
   Because the constructor throws before returning, the caller's 
try-with-resources never binds the `Reader`, so its `close()` never runs and 
the `SeekableInputStream` (a real file descriptor) leaks. The IOException path 
already closes it.
   
   **Anything else?**
   Fix: widen the catch to `IOException | RuntimeException` so the stream is 
closed on both failure paths, mirroring the existing IOException branch.
   
   **Are you willing to submit a PR?**
   - [x] I'm willing to submit a PR!
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to