-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the Issue
I'm running into an issue with GraalVM CE 25.0.1 that is hard to reproduce.
import java.io.*;
import java.nio.file.Path;
import java.util.zip.GZIPInputStream;
public class GzipTestApp {
public static void main(String[] args) throws IOException {
try (InputStream inputStream = new GZIPInputStream(new FileInputStream(Path.of(args[0]).toFile()), Integer.parseInt(args[1]))) {
while(inputStream.read() != -1){};
}
}
}When I compile and run this class with a valid bgzip file and buffer size (e.g. 32768) all is fine.
When I create a native image with default options of this file I intermittently get an exception, example:
./gziptestapp file.gz 2048
Exception in thread "main" java.util.zip.ZipException: Corrupt GZIP trailer
at java.base@25/java.util.zip.GZIPInputStream.readTrailer(GZIPInputStream.java:259)
at java.base@25/java.util.zip.GZIPInputStream.read(GZIPInputStream.java:153)
at java.base@25/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:156)
at GzipTestApp.main(GzipTestApp.java:8)
I've encountered this issue with various valid files. The files were not being modified.
Going down the rabit hole let me to this 2012 report which has the similarity when the symptom appears, it appears for hours at a time. And once it stops appearing it cannot be reproduced with any file. The report mentions that "This issue only happens when the GZIPInputStream methods are inlined by the JIT compiler into the com/cognos/cm/util/GzipInflater.inflate method", could something like this explain why the error only occurs with native image and not with 'normal' java?
Using the latest version of GraalVM can resolve many issues.
- I tried with the latest version of GraalVM.
GraalVM Version
.
Operating System and Version
Linux nibbler 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 13:59:22 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Troubleshooting Confirmation
- I tried the suggestions in the troubleshooting guide.
Run Command
.
Expected Behavior
.
Actual Behavior
.
Steps to Reproduce
.
Additional Context
No response
Run-Time Log Output and Error Messages
No response