[Bug] FileIndexFormat.Reader leaks input stream when construction fails with a runtime exception

Aperta Adatta ai principianti
#8,765 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
java

Direzione di ricerca

Inizia da FileIndexFormat.createReader e leggi le righe 248-261 e 282 di FileIndexFormat.java, concentrandoti sulla costruzione di Reader e sul percorso di cleanup esistente per IOException. Riproduci il problema con un file di indice corrotto o di versione errata, quindi verifica che anche gli errori RuntimeException durante la costruzione chiudano il SeekableInputStream di proprietà, mentre il comportamento esistente per IOException rimane invariato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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!
Lingua principale
Java
Stelle
3.4k
Fork
1.4k
Merge medio
1g 14h
PR unite (30g)
468

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/paimon

Tutte le issue di apache/paimon

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.