Skip to content

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

Open
@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. $ sudo gdb bin/php7/bin/php $(cat server.lock) - this attaches to the server process
  2. (gdb) source path/to/php/.gdbinit - load PHP's .gdbinit (which is usually not immediately to hand unless the binary was built with -d or -n, even though it's usable without either of these flags).
  3. (gdb) zbacktrace - generates a PHP backtrace for the main thread.
  4. (gdb) bt - generates a native backtrace for the main thread (usually not needed)

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