puma icon indicating copy to clipboard operation
puma copied to clipboard

Support backtrace signals on Linux with SIGPWR

Open emilong opened this issue 10 months ago • 2 comments

Description

I wanted to be able to get stack traces from a running Puma process on Linux. I noticed some Linux distributions alias SIGINFO to SIGPWR, so chose that as the Linux signal for the operation. Specifically if SIGINFO is missing on the given system, this change falls back to using SIGPWR for the backtrace signal instead. pumactl shares the "detection" code with puma itself, so sending info from pumactl will allow backtraces in either case.

I tested this manually on Linux and a FreeBSD VM to validate it works on both as there weren't automated tests for signal handling already.

Your checklist for this pull request

  • [x] I have reviewed the guidelines for contributing to this repository.
  • [x] My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • [x] I have updated the documentation accordingly.
  • [x] All new and existing tests passed, including Rubocop.

emilong avatar Mar 12 '25 00:03 emilong

I just swapped the default branch name from master to main, you don't need to do anything for this PR. You'll need to update your local environment accordingly:

$ git fetch && git checkout main

When you rebase in the future, use main instead of master. (posting this to all open PRs)

schneems avatar Oct 18 '25 20:10 schneems

This would be very useful for me, as I'm currently trying to figure out stuck puma workers.

fschwahn avatar Nov 20 '25 10:11 fschwahn