Disable SVE when detecting Java version - #4765
Conversation
|
That's weird. When I run the |
There was a problem hiding this comment.
I think we should just make this regex better instead?
|
It's a virtual machine run by Parallels Desktop, that probably comes into play as well 🫤. Either way, I'll improve the version parsing regex and hope that it's an acceptable change. |
I am trying to start Solr in a Docker container in a virtual `arm64` Linux machine on Apple Silicon hardware. To my knowledge, this configuration does (currently?) not support SVE vector length detection. When `bin/solr` runs `java -version`, this makes the JVM emit a notice: ``` Starting Solr Your current version of Java is too old to run this version of Solr. We found major version , using command '/opt/java/openjdk/bin/java -version', with response: OpenJDK 64-Bit Server VM warning: Unable to get SVE vector length on this system. Disabling SVE. Specify -XX:UseSVE=0 to shun this warning. openjdk version "25.0.3" 2026-04-21 LTS OpenJDK Runtime Environment Temurin-25.0.3+9 (build 25.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-25.0.3+9 (build 25.0.3+9-LTS, mixed mode, sharing) Please install latest version of Java 21 or set JAVA_HOME properly. ``` Version detection trips over this extra warning line. So, improve version parsing logic to go over warning lines and lock to the first `version` line.
|
Changed to lock to the first |
| exit 1 | ||
| else | ||
| JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//') | ||
| JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | awk -F '"' '/ version "/ {print $2; exit}' | sed -e's/^1\.//' | sed -e's/[._-].*$//') |
There was a problem hiding this comment.
have these been run against a bunch of different jdk versions to see if this works?
|
I haven't actually run the changed script against different Java/JVM versions since I don't have them at hand. However, AI researched a few typical Does that help? #!/bin/bash
# Standalone test for the JAVA_VER_NUM extraction logic in solr/bin/solr (line ~178).
# Run: bash test-java-version-parsing.sh
set -u
extract() {
echo "$1" | grep -v '_OPTIONS' | awk -F '"' '/ version "/ {print $2; exit}' | sed -e's/^1\.//' | sed -e's/[._-].*$//'
}
pass=0
fail=0
check() {
local desc="$1" input="$2" expected="$3"
local actual
actual=$(extract "$input")
if [[ "$actual" == "$expected" ]]; then
printf 'PASS %-55s got %s\n' "$desc" "$actual"
pass=$((pass+1))
else
printf 'FAIL %-55s expected %s, got "%s"\n' "$desc" "$expected" "$actual"
fail=$((fail+1))
fi
}
check "Java 8, old 1.x scheme" \
'java version "1.8.0_412"
Java(TM) SE Runtime Environment (build 1.8.0_412-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.412-b08, mixed mode)' \
"8"
check "Java 11 OpenJDK (Temurin)" \
'openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment Temurin-11.0.24+8 (build 11.0.24+8)
OpenJDK 64-Bit Server VM Temurin-11.0.24+8 (build 11.0.24+8, mixed mode)' \
"11"
check "Java 17 IBM Semeru/OpenJ9 + JDK_JAVA_OPTIONS noise line" \
'picked up JDK_JAVA_OPTIONS: -Xshare:off
openjdk version "17.0.11" 2024-04-16
IBM Semeru Runtime Open Edition 17.0.11.0 (build 17.0.11+9)
Eclipse OpenJ9 VM 17.0.11.0 (build openj9-0.44.0, JRE 17 Linux amd64-64-Bit Compressed References 20240416_547)' \
"17"
check "Java 21 OpenJDK (Temurin, LTS)" \
'openjdk version "21.0.4" 2024-07-16 LTS
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode, sharing)' \
"21"
check "Java 21 GraalVM" \
'java version "21.0.2" 2024-01-16
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)' \
"21"
check "Java 25, SVE warning line BEFORE version line (this PR's bug report)" \
'OpenJDK 64-Bit Server VM warning: Unable to get SVE vector length on this system. Disabling SVE. Specify -XX:UseSVE=0 to shun this warning.
openjdk version "25.0.3" 2026-04-21 LTS
OpenJDK Runtime Environment Temurin-25.0.3+9 (build 25.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.3+9 (build 25.0.3+9-LTS, mixed mode, sharing)' \
"25"
echo
echo "For comparison, the OLD logic (head -1 | awk '/version/') on the SVE-warning case:"
old_result=$(echo 'OpenJDK 64-Bit Server VM warning: Unable to get SVE vector length on this system. Disabling SVE. Specify -XX:UseSVE=0 to shun this warning.
openjdk version "25.0.3" 2026-04-21 LTS' | grep -v '_OPTIONS' | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
echo " -> \"${old_result}\" (empty = the reported bug: JAVA_VER_NUM ends up blank)"
echo
echo "$pass passed, $fail failed"
[[ $fail -eq 0 ]] |
I am trying to start Solr in a Docker container in a virtual
arm64Linux machine on Apple Silicon hardware using Parallels Desktop virtualization. Seems this configuration does not support SVE vector length detection.When
bin/solrrunsjava -version, this makes the JVM emit a notice:Version detection trips over this extra warning line. So, improve version parsing logic to go over warning lines and lock to the first
versionline.