https://github.com/puma/puma/pull/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.
* Add pumactl command to print thread backtraces
Completes 1 of 2 items from #1964
This commit adds an endpoint to the status app to print thread
backtraces, and control cli command to call that endpoint.
I tried this locally by starting a server with:
```sh
bundle exec bin/puma test/rackup/hello.ru \
--control-url="unix://test.sock" \
--control-token="token"
```
and then printing the backtraces with:
```sh
bundle exec bin/pumactl thread-backtraces \
--control-url="unix://test.sock" \
--control-token="token"
```
* Log threads as JSON in control app
With this commit the status app sends the thread backtraces as an array
of objects with `name` and `backtrace` keys, rather than as a string
matching the SIGINFO output.
While working on this I noticed that we logged the thread TID twice.
This commit simplifies that so we only log the thread TID once, with
both the label (I don't know when the label would get set) and name if
they are available.
* Update test_integration files per PR #1956
test_integration_cluster.rb
Request handling during server TERM - two tests
`#test_term_closes_listeners_tcp`
`#test_term_closes_listeners_unix`
using `#term_closes_listeners`
Send requests 10 per second. Send 10, then :TERM server, then send another 30.
No more than 10 should throw Errno::ECONNRESET.
Request handling during phased restart - two tests
`#test_usr1_all_respond_tcp`
`#test_usr1_all_respond_unix`
using `#usr1_all_respond`
Send requests 1 per second. Send 1, then :USR1 server, then send another 24.
All should be responded to, and at least three workers should be used
Stuck worker tests - two tests
`#test_stuck_external_term_spawn`
Tests whether externally TERM'd 'stuck' workers are proper re-spawned.
`#test_stuck_phased_restart`
Tests whether 'stuck' workers are properly shutdown during phased-restart.
helper files/methods changes
1. helper file changes to allow binding to TCP or UNIX, see kwarg unix:
2. Skip on Windows for signal TERM
* Misc updates, debug output, cleanup
* Add comments
* fix test_int_signal_with_background_thread_in_jruby per review
* TestIntegrationCluster#term_closes_listeners - add interleaved assert
* cluster.rb - remove duplicate Worker#term? method