Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ManifestVersionReader leaks a ZipFile Inflater per JAR (openStream never closed)

Chiusa
#6,120 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@0xadam-brown ci sta già lavorando.

Dal 16/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Platform: Java Type: Bug

Description

ManifestVersionReader.readManifestFiles() enumerates every META-INF/MANIFEST.MF on the classpath and passes URL.openStream() into new Manifest(InputStream) without closing the stream.

java.util.jar.Manifest(InputStream) reads the stream and does not close it. For jar: URLs that stream is a ZipFileInflaterInputStream. Closing it is what calls ZipFile$CleanableResource.releaseInflater(). If it is never closed, each JAR leaves a live java.util.zip.Inflater (~64 KiB zlib window).

This still matches main and 8.41.0 / 8.52.0.

Call site

final Enumeration<URL> resources =
    ClassLoader.getSystemClassLoader().getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
  try {
    final Manifest manifest = new Manifest(resources.nextElement().openStream());
    // ...
  } catch (Exception e) {
    // ignore
  }
}

Triggered from ManifestVersionDetector.checkForMixedVersions()InitUtil.shouldInit()Sentry.init().

Observed

Compose Desktop / packaged JVM app with ~80 JARs on the classpath (sentry-java 8.41.0):

  • GC.class_histogram: 168 live java.util.zip.Inflater
  • async-profiler event=java.util.zip.Inflater.<init> from process start: 79 / 174 constructors (45%) are
java.util.zip.Inflater.<init>
java.util.zip.ZipFile$CleanableResource.getInflater
java.util.zip.ZipFile$ZipFileInflaterInputStream.<init>
java.util.zip.ZipFile.getInputStream
java.util.jar.JarFile.getBytes
java.util.jar.JarFile.checkForSpecialAttributes
java.util.jar.JarFile.isMultiRelease
java.util.jar.JarFile.getEntry
sun.net.www.protocol.jar.URLJarFile.getEntry
sun.net.www.protocol.jar.JarURLConnection.connect
sun.net.www.protocol.jar.JarURLConnection.getInputStream
java.net.URL.openStream
io.sentry.internal.ManifestVersionReader.readManifestFiles
io.sentry.ManifestVersionDetector.checkForMixedVersions
io.sentry.util.InitUtil.shouldInit
io.sentry.Sentry.init

Suggested fix

try (InputStream is = resources.nextElement().openStream()) {
  final Manifest manifest = new Manifest(is);
  // existing attribute handling
} catch (Exception e) {
  // ignore
}

Manifest does not take ownership of the stream, so try-with-resources is required even on the success path.

Lingua principale
Kotlin
Stelle
1.4k
Fork
478
Merge medio
2g 20h
PR unite (30g)
71

Guida per i contributori

Apri la guida per i contributori

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 getsentry/sentry-java

Tutte le issue di getsentry/sentry-java

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.