wombatu-kun opened a new issue, #9007:
URL: https://github.com/apache/paimon/issues/9007

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   ### Paimon version
   
   master, 142f8239b
   
   ### Compute Engine
   
   Engine independent, format tables.
   
   ### Minimal reproduce step
   
   Found by code inspection rather than from a failing job. Make a format 
writer throw an unchecked exception out of `close()`; several format writers 
wrap IO failures in `RuntimeException` or `UncheckedIOException`.
   
   ### What doesn't meet your expectations?
   
   `FormatTableSingleFileWriter.close()` routes only `IOException` to the 
cleanup path:
   
   ```java
   try {
       if (writer != null) {
           writer.close();
           writer = null;
       }
       if (out != null) {
           out.flush();
           outputBytes = out.getPos();
           committer = ((TwoPhaseOutputStream) out).closeForCommit();
           out = null;
       }
   } catch (IOException e) {
       LOG.warn("Exception occurs when closing file {}. Cleaning up.", path, e);
       abort();
       throw e;
   } finally {
       closed = true;
   }
   ```
   
   An unchecked throw out of `writer.close()` skips `abort()` entirely, so 
`out` is left open and the data staged for the two phase commit is never 
discarded. The `finally` block then sets `closed = true`, so a later `close()` 
returns at the top of the method and nothing else will clean up.
   
   Note that `abort()` itself is written defensively, catching `Throwable` 
around both the `closeForCommit` and the `discard` calls. The problem is only 
that it never runs.
   
   ### Anything else?
   
   Fix shape: widen the catch around the cleanup decision to `Throwable`, 
keeping the existing rethrow behaviour for `IOException`.
   
   Reported alongside two stream leak reports found in the same pass while 
reviewing #8962.
   
   ### 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