[Bug] FileIndexFormat.Reader leaks input stream when construction fails with a runtime exception
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- data-engineering
Research direction
Start at FileIndexFormat.createReader and read FileIndexFormat.java lines 248-261 and 282, focusing on Reader construction and the existing IOException cleanup path. Reproduce with a corrupt or wrong-version index file, then verify that construction-time RuntimeException failures also close the owned SeekableInputStream while the existing IOException behavior remains intact.
Written by the indexing model from the issue text.
Description
Search before asking
- I searched in the 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?
- I'm willing to submit a PR!
- Dominant language
- Java
- Stars
- 3.4k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 468
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/paimon
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
[Bug] [Hive] IndexOutOfBoundsException when converting an unavailable dynamic BETWEEN predicate Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100