-
Notifications
You must be signed in to change notification settings - Fork 762
Closed
Labels
Description
Describe the bug
I encounter OutOfMemoryError over GHRepository.readZip while having reasonable free heap.
To Reproduce
Steps to reproduce the behavior:
- Consider a large Github repository (e.g. 50MB)
- Rely on GHRepository.readZip, while being a bit memory constrained (e.g. with Xmx128M)
- Encounter a OutOfMemoryError
Expected behavior
I would expect the whole InputStream not to be materialized in-memory by org.kohsuke.github.connector.GitHubConnectorResponse.ByteArrayResponse.bodyStream()
Additional context
A typical stack looks like:
Java heap space: java.lang.OutOfMemoryError
java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.AbstractByteArrayOutputStream.toByteArrayImpl(AbstractByteArrayOutputStream.java:366)
at org.apache.commons.io.output.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:163)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:2241)
at org.kohsuke.github.connector.GitHubConnectorResponse$ByteArrayResponse.bodyStream(GitHubConnectorResponse.java:187)
at org.kohsuke.github.Requester.lambda$fetchStream$3(Requester.java:117)
at org.kohsuke.github.Requester$$Lambda$568/0x00000008404da440.apply(Unknown Source)
at org.kohsuke.github.GitHubClient.createResponse(GitHubClient.java:485)
at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:387)
at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:355)
at org.kohsuke.github.Requester.fetchStream(Requester.java:117)
at org.kohsuke.github.GHRepository.downloadArchive(GHRepository.java:3246)
at org.kohsuke.github.GHRepository.readZip(GHRepository.java:3195)
aalmiray