首页 > 解决方案 > Java 运行时环境检测到致命错误

问题描述

我创建了以下 docker 映像,其中包含执行 opencv 和 tesseract 操作的 spring boot 应用程序:

FROM openjdk:17-alpine


RUN apk update && \
    apk upgrade && \
    apk add --no-cache tesseract-ocr opencv gcompat

COPY myapp-1.0.0.jar myapp-1.0.0.jar

ENTRYPOINT ["java","-jar","/myapp-1.0.0.jar"]

当我尝试在 linux 机器(2 个不同的 vms 或 google.cloud)上运行它时,它会启动,其他端点工作但是当我调用启动 opencv 操作的端点时,我收到以下错误:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000000001e1766, pid=1, tid=124
#
# JRE version: OpenJDK Runtime Environment (17.0+14) (build 17-ea+14)
# Java VM: OpenJDK 64-Bit Server VM (17-ea+14, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  0x00000000001e1766
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e %P %I %h" (or dumping to //core.1)
#
# An error report file with more information is saved as:
# //hs_err_pid1.log
[thread 125 also had an error][thread 127 also had an error][thread 128 also had an error]

谁能帮我分析一下?我理解它是一个原生的 C 问题。可能是opencv或依赖项?但为什么?我认为它从以下 opencv 函数开始:

Mat map = Imgcodecs.imdecode(new MatOfByte(byteArray), Imgcodecs.IMREAD_UNCHANGED);

完整的错误日志在这里

标签: dockeropencvjava-17

解决方案


推荐阅读