Skip to content

panic when no certs are present in the Linux system #982

@krichprollsch

Description

@krichprollsch

I can reproduce with a docker w/o cert files

FROM docker.io/debian:stable-slim

COPY zig-out/bin/lightpanda /lightpanda

RUN groupadd -r lightpanda && useradd -rm -g lightpanda lightpanda

USER lightpanda

EXPOSE 9222/tcp

ENTRYPOINT ["/lightpanda"]
CMD ["serve", "--host", "0.0.0.0", "--port", "9222"]
$ docker build -t lpd:no-certs -f Dockerfile.test .
$ docker run  -ti --rm lpd:no-certs
thread 1 panic: reached unreachable code
/usr/local/zig-0.14.1/lib/std/debug.zig:550:14: 0x306846d in assert (lightpanda)
/home/pierre/wrk/browser/src/http/Http.zig:362:21: 0x3114b20 in loadCerts (lightpanda)
/home/pierre/wrk/browser/src/http/Http.zig:70:32: 0x31193e9 in init (lightpanda)
/home/pierre/wrk/browser/src/app.zig:49:33: 0x311afc7 in init (lightpanda)
/home/pierre/wrk/browser/src/main.zig:96:27: 0x316f8fd in run (lightpanda)
/home/pierre/wrk/browser/src/main.zig:56:8: 0x3171a69 in main (lightpanda)
/usr/local/zig-0.14.1/lib/std/start.zig:660:37: 0x31721c2 in main (lightpanda)
???:?:?: 0x7011b994fca7 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x7011b994fca7` was not available, trace may be incomplete

With a release build I get

thread 1 panic: reached unreachable code
/usr/local/zig-0.14.1/lib/std/array_list.zig:912:35: 0x222956c in init (lightpanda)
/home/pierre/wrk/browser/src/main.zig:96:27: 0x228fcbd in run (lightpanda)
/home/pierre/wrk/browser/src/main.zig:56:8: 0x229e3c0 in main (lightpanda)
???:?:?: 0x77b217816ca7 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x77b217816ca7` was not available, trace may be incomplete

Adding certs in the docker image fixes the crash.

RUN set -x \
    && apt-get update \
    && apt-get install -y ca-certificates

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions