googleapis/java-logging-logback

SIGSEGV Under Alpine Linux

bcwhite-code opened this issue · 1 comments

I have a Cloud-Run Java app built into a Docker container using the openjdk:17-alpine base image. Everything runs fine until I activate my "cloud" log appender:

    <appender name="cloud" class="com.google.cloud.logging.logback.LoggingAppender">
        <log>backend</log>
        <flushLevel>WARN</flushLevel>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>INFO</level>
        </filter>
    </appender>

Then the VM crashes immediately at startup:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000000000207d6, pid=1, tid=11
#
# 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, serial gc, linux-amd64)
# Problematic frame:
# C 0x00000000000207d6
#
# Core dump will be written. Default location: core.1 (may not exist)
#
# An error report file with more information is saved as:
# /app/hs_err_pid1.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Uncaught signal: 6, pid=1, tid=11, fault_addr=0.
Container terminated on signal 6.

When I change my base image to be openjdk:17-slim then the SEGV goes away.

I suspect that com.google.cloud.logging.logback.LoggingAppender has some hidden dependency on glibc. Alpine linux uses musl libc.

I just tried this again with eclipse-temurin:17-jdk-alpine and then eclipse-temurin:17-jre-alpine. I no longer get a SEGV. This could be because of my switch from the (now deprecated) "openjdk" image instead of changes in your library but either way, it's now working for me.