Skip to content

Native memory leak - GZIPInputStream is not closed #949

@csegedicsaba

Description

@csegedicsaba

Using jwt token with GZIP compression cause native (not heap) memory leak because the GZIPInputStream is not closed.

After large number of decompressing cca. 500 MB of extra memory is used by the java process. This extra usage can see in /proc/1/status only. The java native memory tracking will not show it.

Running application in kubernetes will result kubernetes level OOM because this extra memory usage when memory limit is set.

Hacking GzipCompressionAlgorithm.doDecompress(InputStream is) like this there is no memory leak:

protected InputStream doDecompress(InputStream is) throws IOException {
    GZIPInputStream gzipIs = new GZIPInputStream(is);
    byte[] tmpIs = gzipIs.readAllBytes();
    gzipIs.close();
    return Streams.of(tmpIs);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions