SIGSEGV 🐧 Linux

Segmentation fault (core dumped)

A program accessed memory it wasn’t allowed to, and the kernel killed it with SIGSEGV (exit code 139).

Seen on: Linux Python Docker

Meaning

In your own C/C++/Rust-unsafe code it’s a memory bug (null/dangling pointer, buffer overflow, stack overflow). In Python, Node, PHP or Ruby it’s almost always a native extension crashing — or binary/library version mismatches.

Common causes

  • Null or dangling pointer dereference
  • Buffer overflow / out-of-bounds access
  • Stack overflow from deep recursion
  • Native extension built for a different library/runtime version
  • Corrupted binary or bad RAM (rare)

⚡ Quick fix

  1. Run it under gdb to get a backtrace
  2. Rebuild/reinstall native extensions after upgrades
  3. Increase stack size if recursion is legitimate (ulimit -s)
  4. Use AddressSanitizer in development builds

Detailed fix by platform

Linux

  1. Get a backtrace:
    bash
    gdb --args ./myprogram arg1
    (gdb) run
    (gdb) bt            # stack trace at the crash
    # or analyse a core dump:
    coredumpctl list && coredumpctl gdb

Python

  1. python -X faulthandler app.py prints the Python stack at a segfault, showing which C extension crashed.

How to diagnose

  1. Where — Backtrace — whose code crashed?
  2. Recent change — Upgraded runtime/library?
  3. Reproduce — Specific input triggers it?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.