Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dktapps opened this issue Jul 8, 2021 · 0 comments

Comments

@dktapps
Copy link
Member

dktapps commented Jul 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant