javadockermacoskeycloak

M4 cannot run docker keycloak image


M4 CPU wasn't able to build keycloack docker image.

  my-keycloak:
    image: quay.io/keycloak/keycloak:26.1.2
    environment:
      KC_HOSTNAME: localhost
      KC_HOSTNAME_PORT: 7080
      KC_HOSTNAME_STRICT_BACKCHANNEL: "true"
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: admin
      KC_HEALTH_ENABLED: "true"
      KC_LOG_LEVEL: info

A fatal error has been detected by the Java Runtime Environment:

SIGILL (0x4) at pc=0x0000ffff7ef3fc5c, pid=1, tid=7

JRE version: (21.0.6+7) (build ) Java VM: OpenJDK 64-Bit Server VM (21.0.6+7-LTS, mixed mode, sharing, tiered, compressed Oops, compressed class ptrs, g1 gc, linux-aarch64) Problematic frame: j java.lang.System.registerNatives()V+0 java.base

No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as: /opt/keycloak/hs_err_pid1.log [0.010s][warning][os] Loading hsdis library failed

The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

I tried without success to run ulimit -c unlimited. I also read and apply tips in this anwer. No more success!


Solution

  • Here is the solution:

      my-keycloak:
        image: quay.io/keycloak/keycloak:26.1.2
        environment:
          JAVA_OPTS_APPEND: "-XX:UseSVE=0"
    

    I discover this solved issue. The bug only appears since MacOS15.2 upgrade. The JVM and the JDK have been upgraded and no more bug appears. BUT, it still happens on my docker build, because JDK isn't up to date. Yet...

    I read issue and discover that the SVE is the node of worries. So I tried to unactivate it with JAVA_OPTS and it's working. By adding the -XX:UseSVE=0, it disables SVE. To add it to JAVA_OPTS, I just have to filled the JAVA_OPTS_APPEND environment variable.