jreleaser/release-action

java.lang.OutOfMemoryError when uploading, to GitHub Releases, an artifact of big size

Closed this issue · 2 comments

I have an artifact defined as :

distributions:
  my-artifact:
    artifacts:
      - path: myArtifact.zip
  • The artifact needs to be uploaded to the GitHub Release set of Assets.
  • The size of the ZIP file is 621MB

Using this GitHub Action I always see the following output:

Error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  	at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
  	at java.base/java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:120)
  	at java.base/java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:95)
  	at java.base/java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:156)
  	at java.base/sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78)
  	at jreleaser.shadow.org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo.buildRequest(GitHubHttpUrlConnectionClient.java:145)
  	at jreleaser.shadow.org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo.setupConnection(GitHubHttpUrlConnectionClient.java:119)
  	at jreleaser.shadow.org.kohsuke.github.GitHubHttpUrlConnectionClient.getResponseInfo(GitHubHttpUrlConnectionClient.java:55)
  	at jreleaser.shadow.org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:387)
  	at jreleaser.shadow.org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:355)
  	at jreleaser.shadow.org.kohsuke.github.Requester.fetch(Requester.java:76)
  	at jreleaser.shadow.org.kohsuke.github.GHRelease.uploadAsset(GHRelease.java:249)
  	at jreleaser.shadow.org.kohsuke.github.GHRelease.uploadAsset(GHRelease.java:224)
  	at jreleaser.shadow.org.jreleaser.sdk.github.Github.uploadAssets(Github.java:156)
  	at jreleaser.shadow.org.jreleaser.sdk.github.GithubReleaser.createRelease(GithubReleaser.java:213)
  	at jreleaser.shadow.org.jreleaser.sdk.github.GithubReleaser.createRelease(GithubReleaser.java:126)
  	at jreleaser.shadow.org.jreleaser.model.releaser.spi.AbstractReleaser.release(AbstractReleaser.java:51)
  	at jreleaser.shadow.org.jreleaser.engine.release.Releasers.release(Releasers.java:44)
  	at jreleaser.shadow.org.jreleaser.workflow.ReleaseWorkflowItem.invoke(ReleaseWorkflowItem.java:34)
  	at jreleaser.shadow.org.jreleaser.workflow.WorkflowImpl.execute(WorkflowImpl.java:66)
  	at jreleaser.shadow.org.jreleaser.cli.FullRelease.doExecute(FullRelease.java:144)
  	at jreleaser.shadow.org.jreleaser.cli.AbstractModelCommand.execute(AbstractModelCommand.java:81)
  	at jreleaser.shadow.org.jreleaser.cli.AbstractCommand.call(AbstractCommand.java:36)
  	at jreleaser.shadow.org.jreleaser.cli.AbstractModelCommand.call(AbstractModelCommand.java:47)
  	at jreleaser.shadow.org.jreleaser.cli.AbstractCommand.call(AbstractCommand.java:29)
  	at jreleaser.shadow.picocli.CommandLine.executeUserObject(CommandLine.java:1953)
  	at jreleaser.shadow.picocli.CommandLine.access$1300(CommandLine.java:145)
  	at jreleaser.shadow.picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
  	at jreleaser.shadow.picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
  	at jreleaser.shadow.picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
  	at jreleaser.shadow.picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
  	at jreleaser.shadow.picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
  Error: Process completed with exit code 1.

Note: I've executed JReleaser locally on my Laptop to upload the desired ZIP file and it worked well. I suppose this issue has to do with Github Actions Environment itself.

Is there a way to avoid fix this issue?

Wow, that is indeed a very BIG file. A possible fix would be to specify JVM parameters that tweak memory settings however the action does not allow such parameters to be passed to the underlying Java process, not yet.

Fixed with 2.2.0 and v2.