Skip to content

Crash in mix when ca-certificates cannot be parsed #14322

@weisslj

Description

@weisslj

Elixir and Erlang/OTP versions

$ elixir --version
Erlang/OTP 27 [erts-15.2.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.17.3 (compiled with Erlang/OTP 27)

Operating system

Linux (Debian)

Current behavior

I get this noisy error when the system /etc/ssl/certs/ca-certificates.crt cannot be parsed for some reason:

$ mix deps.get
[...]
12:15:31.438 [error] Failure while translating Erlang's logger event
** (ArgumentError) construction of binary failed: segment 2 of type 'binary': expected a binary but got: [70, 97, 105, 108, 101, 100, 32, 116, 111, 32, 108, 111, 97, 100, 32, 99, 97, 99, 101, 114, 116, 115, 58, 32, ~c"operating system CA bundle could not be located"]
    (elixir 1.17.3) lib/exception.ex:2456: ErlangError.error_info/3
    (elixir 1.17.3) lib/exception.ex:2413: ErlangError.normalize/2
    (logger 1.17.3) lib/logger/translator.ex:669: Logger.Translator.maybe_normalize/2
    (logger 1.17.3) lib/logger/translator.ex:632: Logger.Translator.format_reason/1
    (logger 1.17.3) lib/logger/translator.ex:111: Logger.Translator.translate/4
    (logger 1.17.3) lib/logger/utils.ex:47: Logger.Utils.translate/5
    (logger 1.17.3) lib/logger/utils.ex:19: Logger.Utils.translator/2
    (kernel 10.2.2) logger_backend.erl:102: :logger_backend.do_apply_filters/4

{error,badarg,[{'Elixir.ErlangError',error_info,3,[{file,"lib/exception.ex"},{line,2456},{error_info,#{cause=>{2,binary,type,[70,97,105,108,101,100,32,116,111,32,108,111,97,100,32,99,97,99,101,114,116,115,58,32,"operating system CA bundle could not be located"]},function=>format_bs_fail,module=>erl_erts_errors}}]},{'Elixir.ErlangError',normalize,2,[{file,"lib/exception.ex"},{line,2413}]},{'Elixir.Exception',format_banner,3,[{file,"lib/exception.ex"},{line,135}]},{'Elixir.Exception',format_exit,2,[{file,"lib/exception.ex"},{line,445}]},{'Elixir.Exception',format_banner,3,[{file,"lib/exception.ex"},{line,148}]},{'Elixir.Kernel.CLI',format_error,3,[{file,"lib/kernel/cli.ex"},{line,107}]},{'Elixir.Kernel.CLI',print_error,3,[{file,"lib/kernel/cli.ex"},{line,177}]},{'Elixir.Kernel.CLI',exec_fun,2,[{file,"lib/kernel/cli.ex"},{line,165}]}]}
Runtime terminating during boot ({badarg,[{'Elixir.ErlangError',error_info,3,[{file,"lib/exception.ex"},{line,2456},{error_info,#{cause=>{2,binary,type,[70,97,105,108,101,100,32,116,111,32,108,111,97,100,32,99,97,99,101,114,116,115,58,32,"operating system CA bundle could not be located"]},function=>format_bs_fail,module=>erl_erts_errors}}]},{'Elixir.ErlangError',normalize,2,[{file,"lib/exception.ex"},{line,2413}]},{'Elixir.Exception',format_banner,3,[{file,"lib/exception.ex"},{line,135}]},{'Elixir.Exception',format_exit,2,[{file,"lib/exception.ex"},{line,445}]},{'Elixir.Exception',format_banner,3,[{file,"lib/exception.ex"},{line,148}]},{'Elixir.Kernel.CLI',format_error,3,[{file,"lib/kernel/cli.ex"},{line,107}]},{'Elixir.Kernel.CLI',print_error,3,[{file,"lib/kernel/cli.ex"},{line,177}]},{'Elixir.Kernel.CLI',exec_fun,2,[{file,"lib/kernel/cli.ex"},{line,165}]}]})

Crash dump is being written to: erl_crash.dump...done

The crash only appears with Elixir >= 1.17 and OTP >= 27. With Elixir 1.16.3 and OTP 27 I get this warning instead:

warning: failed to load system certificates. SSL peer verification will be skipped but downloads are still verified with a checksum

With OTP <= 26 and Elixir 16.x or 17.x mix seems to work despite unparsable /etc/ssl/certs/ca-certificates.crt.

Expected behavior

I would expect Elixir to write an error like "error, cannot parse system CA certificates, aborting", but not to crash noisy like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions