Java Springboot 构建在 raspberry pi 中失败

Java Springboot build fails in raspberry pi

总结

我正在尝试在我的 raspberry pi 上构建 springboot 应用程序,但出现 SIGBUS (0x7) 错误

错误:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0x7) at pc=0xb3de3a84, pid=7, tid=32
#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (14.0.2+12) (build 14.0.2+12)
# Java VM: OpenJDK Server VM AdoptOpenJDK (14.0.2+12, mixed mode, sharing, g1 gc, linux-arm)
# Problematic frame:
# v  ~StubRoutines::atomic_load_long
#
# Core dump will be written. Default location: /server/core
#
# An error report file with more information is saved as:
# /server/hs_err_pid7.log

重现步骤

我有一个包含以下代码段的 docker 文件。

COPY .mvn .mvn

COPY pom.xml .

RUN ./mvnw dependency:go-offline

COPY src src

RUN ./mvnw package -DskipTests  # <------- Fails here

在我的另一台装有 ubuntu 的主机上构建良好。 但在 Raspberry Pi 4 上失败 raspbian.

预期结果

预计构建成功,类似于我的其他机器

实际结果

失败并出现以下错误跟踪。

[thread 52 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0x7) at pc=0xb3de3a84, pid=7, tid=32
#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (14.0.2+12) (build 14.0.2+12)
# Java VM: OpenJDK Server VM AdoptOpenJDK (14.0.2+12, mixed mode, sharing, g1 gc, linux-arm)
# Problematic frame:
# v  ~StubRoutines::atomic_load_long
#
# Core dump will be written. Default location: /server/core
#
# An error report file with more information is saved as:
# /server/hs_err_pid7.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/AdoptOpenJDK/openjdk-support/issues
#
Aborted (core dumped)
The command '/bin/sh -c ./mvnw package -DskipTests' returned a non-zero code: 134
ERROR: Service 'server' failed to build

分流信息

Java版本:14.0.2+12

您的操作系统和平台是什么? Raspbian [全] 最新。 Raspberry Pi 4

您是如何安装 Java 的? 上面分享的 Dockerfile 片段。

之前有用吗? 否

您是否测试过其他 Java 版本? 是的 v11

这是一个不充分的 space 问题,请阅读此 https://confluence.atlassian.com/confkb/java-vm-dies-with-sigbus-0x7-when-temp-directory-is-full-on-linux-815584538.html 现在要解决它,您必须在 /tmp 文件夹中提供 space 或使用更大的 space 存储空间设备并分配 space 到 /tmp 文件夹。

编辑:另见 https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6563308

回答我自己的问题, 我尝试了 openjdk 而不是 adoptopenjdk,它成功了。 如果它不适合你,那么也尝试不同版本的 openjdk。