One file makes my C++ API server segfault. Every. Single. Time.

debugginglinuxsegfault2 replies · 285 views · started
  1. Reproducible crash, at least. heavy concurrency kills the C++ API server instantly:

    admin@box:~/build$ ./report-tool --input data.csv

    admin@box:~/build$ ./report-tool --input data.csv
    loading 48213 rows...
    parsing columns... ok
    building index...
    Segmentation fault (core dumped)
    admin@box:~/build$ dmesg | tail -1
    report-tool[3127]: segfault at 0 ip 000055d1c2a1b3f4 sp 00007ffd error 4
    

    i found a core file somewhere once but no idea what to do with it :D do i really need to learn gdb tonight?

    i can reproduce it in staging with the exact same input, which feels like a gift. i just need to know which tools to point at it. Core dumps, debug flags, tracing, whatever. Teach me how to fish here, pls. thx in advance!!

    4
  2. Get a core dump first. On systemd distros they're captured by systemd-coredump:

    coredumpctl list
    coredumpctl info <PID>
    coredumpctl gdb <PID>
    

    In gdb, bt prints the backtrace xD Even without debug symbols, the library names in teh frames usually tell you which native component crashed.

    0 10 helpful
  3. ehh before gdb, Id just pin the previous base image and confirm the crash disappears. bisecting is faster than reading assembly. idk maybe im wrong lol

    9 0 helpful

Reply to this topic

Sign in or create an account to reply.