Solr not starting on MacOS M1 using Azul JVM

Viewed 551

I switched to the Azul JVM in order to use a native ARM JVM and Solr was no longer able to start up. I started seeing a new error in the log:

The stack size specified is too small, Specify at least 384k

If I switch back to the Oracle jvm I do not get this error.

2 Answers

Requirements for stack size appears to be different between ARM and x86 JVMs.

The relevant lines setting the default in bin/solr is:

# Pick default for Java thread stack size, and then add to SOLR_OPTS
if [ -z ${SOLR_JAVA_STACK_SIZE+x} ]; then
  SOLR_JAVA_STACK_SIZE='-Xss256k'
fi
SOLR_OPTS+=($SOLR_JAVA_STACK_SIZE)

The default is too small for the ARM JVM to start up. To increase the stack size add the following line to bin/solr.in.cmd

SOLR_JAVA_STACK_SIZE='-Xss512k'

I faced the same error when trying to start Solr for my Rails app. After a lot of digging, I fixed it by adding the following line to my .zshrc file.

export _JAVA_OPTIONS='-Xss512k'

My use case:

macOS Monterey (M1 2020)

openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Zulu 8.62.0.19-CA-macos-aarch64) (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (Zulu 8.62.0.19-CA-macos-aarch64) (build 25.332-b09, mixed mode)
Related