graalvm / setup-graalvm

GitHub Action for setting up GraalVM distributions.
https://www.graalvm.org
Universal Permissive License v1.0
195 stars 28 forks source link

Getting StackOverflowError with Oracle GraalVM #71

Closed TharmiganK closed 11 months ago

TharmiganK commented 11 months ago

Hi @fniephaus,

We have a workflow which use the setup-graalvm action to run some tests in GraalVM mode. We have recently migrate that to Java 17:

  - name: Set up GraalVM
    uses: graalvm/setup-graalvm@v1
    with:
      version: 'latest'
      java-version: '17'
      components: 'native-image'
      github-token: ${{ secrets.GITHUB_TOKEN }}

With the above configurations the build is failing with this error:

Fatal error: org.graalvm.compiler.debug.GraalError: java.lang.StackOverflowError
    at method: void org.bouncycastle.pqc.crypto.falcon.FalconKeyGen.poly_sub_scaled(int[], int, int, int, int[], int, int, int, int[], int, int, int, int)  [Direct call from int FalconKeyGen.solve_NTRU_intermediate(int, byte[], int, byte[], int, int, int[], int)]
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:1297)

Complete log can be found here: https://github.com/ballerina-platform/module-ballerinax-health.fhir.r4/actions/runs/7137931179/job/19438661771#step:8:12462

But when we change the distribution to GraalVM Community Edition then the build got passed:

  - name: Set up GraalVM
    uses: graalvm/setup-graalvm@v1
    with:
      version: 'latest'
      distribution: 'graalvm-community'
      java-version: '17'
      components: 'native-image'
      github-token: ${{ secrets.GITHUB_TOKEN }}

The passing workflow run: https://github.com/ballerina-platform/module-ballerinax-health.fhir.r4/actions/runs/7138771300/job/19440891466#step:8:12472

I have not tried to reproduce this locally as the build goes OOM in my machine. Appreciate any input on this

fniephaus commented 11 months ago

Hi @TharmiganK,

Thanks for raising this! According to the two build outputs, the builds used either Oracle GraalVM:

Java version: 17.0.9+11-LTS, vendor version: Oracle GraalVM 17.0.9+11.1

or GraalVM CE:

Java version: 17.0.9+9, vendor version: GraalVM CE 17.0.9+9.1.

Since Oracle GraalVM performs additional optimizations, I believe the underlying issue could be a compiler bug. Let me raise this internally with our team.

TharmiganK commented 11 months ago

Thanks for the prompt reply 🙂

fniephaus commented 11 months ago

Have you tried building with Oracle GraalVM and java-version: '21' yet? Would be interesting to know whether it's failing in the same way there.

TharmiganK commented 11 months ago

Have you tried building with Oracle GraalVM and java-version: '21' yet? Would be interesting to know whether it's failing in the same way there.

Not yet, there is no immediate plan to test with Java 21. Will let you know if we did

fniephaus commented 11 months ago

Ok, so it turns out we already know about the problem and fixed it on master. The patch will be included in the 17.0.10 CPU release due on January 16, 2023.