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
Use SIGWINCH to print thread backtraces #2195
Conversation
3e20183
to
4a33fad
Compare
SIGPROF is already used pretty widely in profilers, e.g. stackprof. I'm not sure we can use that signal. |
Just looking at the BSD signal list, maybe SIGVTALRM or SIGWINCH? I'd like to know what people get for the |
NVM, Ruby uses SIGVTALRM internally. SIGWINCH however probably won't interfere with anyone's existing handlers in a webapp. |
On Linux, I get: {"EXIT"=>0, "HUP"=>1, "INT"=>2, "QUIT"=>3, "ILL"=>4, "TRAP"=>5, "ABRT"=>6, "IOT"=>6, "FPE"=>8, "KILL"=>9, "BUS"=>7, "SEGV"=>11, "SYS"=>31, "PIPE"=>13, "ALRM"=>14, "TERM"=>15, "URG"=>23, "STOP"=>19, "TSTP"=>20, "CONT"=>18, "CHLD"=>17, "CLD"=>17, "TTIN"=>21, "TTOU"=>22, "IO"=>29, "XCPU"=>24, "XFSZ"=>25, "VTALRM"=>26, "PROF"=>27, "WINCH"=>28, "USR1"=>10, "USR2"=>12, "PWR"=>30, "POLL"=>29} |
Sounds like SIGWINCH is probably the best option then, yeh? |
puma#1320 added support for using SIGINFO, but this is only available on BSD-based systems. SIGWINCH is on Linux. This is useful for debugging infinite loops or slow performance.
4a33fad
to
8bde1b9
Compare
Yes, thanks. I've also wondered why attaching |
Can you open a new issue? |
I think we're going to have to revert. SIGWINCH gets sent all the time when changing window sizes and so this makes terminal output kind of unusable locally. I'm not sure any other signal would work. |
Ok. Is it possible to use |
Maybe. Do we listen for TTIN in child workers at all right now? |
@nateberkopec Not at the moment. I think I got it to work. It would be a breaking change for anyone issuing |
FWIW, TruffleRuby prints all thread backtraces on |
@eregon Nate commented "Ruby uses SIGVTALRM internally" above, but I'm not sure for what (from a really quick look) |
SIGALRM is different than SIGVTALRM (which is reserved in MRI & TruffleRuby). See https://github.com/ruby/spec/blob/ebdf0d1b06b39374a85baaae53771449ab1fe3d7/core/signal/trap_spec.rb#L118-L133 for the list of reserved signals for each Ruby implementation. |
Description
#1320 added support for using SIGINFO,
but this is only available on BSD-based systems. SIGWINCH is on Linux.
Your checklist for this pull request
[changelog skip]
the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.