ParquetWriter::close sometimes fail
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 1.6k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 33
Description
we sometimes run into an exception when closing a ParquetWriter instance:
```java
2024-06-10 10:44:01.398 org.apache.parquet.util.AutoCloseables$ParquetCloseResourceException: Unable to close resource
2024-06-10 10:44:01.398 at org.apache.parquet.util.AutoCloseables.uncheckedClose(AutoCloseables.java:85)
2024-06-10 10:44:01.398 at org.apache.parquet.util.AutoCloseables.uncheckedClose(AutoCloseables.java:94)
2024-06-10 10:44:01.398 at org.apache.parquet.hadoop.InternalParquetRecordWriter.close(InternalParquetRecordWriter.java:144)
2024-06-10 10:44:01.398 at org.apache.parquet.hadoop.ParquetWriter.close(ParquetWriter.java:437)
2024-06-10 10:44:01.398 Caused by: java.nio.channels.ClosedChannelException: null
2024-06-10 10:44:01.398 at org.apache.hadoop.hdfs.ExceptionLastSeen.throwException4Close(ExceptionLastSeen.java:73)
2024-06-10 10:44:01.398 at org.apache.hadoop.hdfs.DFSOutputStream.checkClosed(DFSOutputStream.java:158)
2024-06-10 10:44:01.398 at org.apache.hadoop.hdfs.DFSOutputStream.flushOrSync(DFSOutputStream.java:639)
2024-06-10 10:44:01.398 at org.apache.hadoop.hdfs.DFSOutputStream.hflush(DFSOutputStream.java:594)
2024-06-10 10:44:01.398 at org.apache.hadoop.fs.FSDataOutputStream.hflush(FSDataOutputStream.java:136)
2024-06-10 10:44:01.398 at org.apache.parquet.hadoop.util.HadoopPositionOutputStream.close(HadoopPositionOutputStream.java:65)
2024-06-10 10:44:01.398 at org.apache.parquet.hadoop.ParquetFileWriter.close(ParquetFileWriter.java:1663)
2024-06-10 10:44:01.398 at org.apache.parquet.util.AutoCloseables.close(AutoCloseables.java:49)
2024-06-10 10:44:01.398 at org.apache.parquet.util.AutoCloseables.uncheckedClose(AutoCloseables.java:83)
```
**Reporter**: [Roelof Naude](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=naude-r)
**Note**: *This issue was originally created as [PARQUET-2496](https://issues.apache.org/jira/browse/PARQUET-2496). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
Contributor guide
No contributing guide indexed for this repository
Research direction
Trace the close path from ParquetWriter.close through InternalParquetRecordWriter.close, ParquetFileWriter.close, and HadoopPositionOutputStream.close, using the supplied ClosedChannelException stack trace as the starting point. Determine the conditions that leave the HDFS output channel closed before hflush, then add coverage for the intermittent failure and verify that closing a ParquetWriter completes without this exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- hadoop, java
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100