Skip to content

linux: provide a tool to easily dump stacks using gdb, from outside the server #121

@dktapps

Description

@dktapps

Users commonly experience problems with their servers hanging, usually because of bad plugin code.

The best way to identify the cause of this problem is using gdb on Linux platforms. However, the process to do this is currently quite cumbersome:

  1. Use the debugging-symbols binaries provided
  2. $ sudo gdb -p $(cat server.lock) - this attaches to the server process
  3. (gdb) source path/to/php/.gdbinit - load PHP's .gdbinit (attached to binary releases, look for Z-PHP-8.3-gdbinit or similar).
  4. (gdb) zbacktrace - generates a PHP backtrace for the main thread

Optionally:

  1. (gdb) bt - generates a native backtrace for the main thread (usually not needed)
  2. (gdb) info threads - gives a list of running threads
  3. (gdb) thread <thread number> and then repeat steps 4 and 5 to generate backtraces for other threads
    as well as a bunch of other finer details.

These steps can be repeated at intervals to see if there's a common theme on where the server is stuck.

It would be beneficial to users if this process could be reduced to a simple bash script like dump-server-stacks.sh, which, when run, would dump the stack traces of all currently active threads into the console without the confusing bullshit in the mix.

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