ManifestVersionReader leaks a ZipFile Inflater per JAR (openStream never closed)
維護者通常 2 天內回覆
@0xadam-brown 已經在處理了。
開始於 2026年9月16日。
評估
這個 Issue 還沒有評估資料。
描述
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 livejava.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.
- 主要語言
- Kotlin
- 星號
- 1.4k
- 分支
- 479
- 平均合併
- 3 天 21 小時
- 30 天內合併 PR
- 64
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getsentry/sentry-java 的其他 Issue
-
Platform: Java
難度 2/5 半天 新手友好度 76/100
getsentry/sentry-java#6161 · 1 則留言 ·
維護者通常 2 天內回覆
-
Bug Java Platform: Android Platform: Java Replays
難度 2/5 1-3 小時 新手友好度 78/100
getsentry/sentry-java#6138 · 1 則留言 ·
維護者通常 2 天內回覆
-
Feature Java Platform: Java Spans
難度 2/5 1-3 小時 新手友好度 68/100
getsentry/sentry-java#5984 · 1 則留言 ·
維護者通常 2 天內回覆
-
Android Task Traces
難度 2/5 1-3 小時 新手友好度 68/100
getsentry/sentry-java#5376 · 1 則留言 ·
維護者通常 2 天內回覆
-
Android Docs Errors
難度 2/5 1-3 小時 新手友好度 64/100
getsentry/sentry-java#5375 · 1 則留言 ·
維護者通常 2 天內回覆
查看 getsentry/sentry-java 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 83/100
Kotlin/kotlin-lsp#288 ·
-
needs-triage
難度 2/5 1-3 小時 新手友好度 76/100
chrisbanes/haze#1536 ·
維護者通常 1 天內回覆
-
Cassiopeia drops the `präsentiert von` credit printed in the event body可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉afk-ok area:data-quality importer size:S
難度 2/5 1-3 小時 新手友好度 77/100
enorm-labs/event-junkie#3166 ·
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 84/100
rajpreetcodes/Skills_MCP_Server#25 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
com-lihaoyi/mill#7776 ·
維護者通常 1 天內回覆