I created the following docker image containing a spring boot application that performs opencv and tesseract operations:
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"]
When i try to run it on a linux machine (2 differnt vms or google.cloud), it starts, other endpoints work but when i call the endpoint that starts the opencv operations, i get the following error:
#
# 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]
Can anybody help me to analyze that? I understand its a native C issue. Probably opencv or a dependency? But Why? I think it starts with the following opencv function:
Mat map = Imgcodecs.imdecode(new MatOfByte(byteArray), Imgcodecs.IMREAD_UNCHANGED);
complete error log here