* Restore sync=true on STDOUT/STDERR streams
* Move mutation of STDOUT and STDERR streams to `redirect_io`
This isn't technically related to redirecting the STDOUT and STDERR
streams, but moving it here keeps all of the STDOUT/STDERR logic
together. It seems like a more natural place to put it.
* Add a test to ensure that STDOUT is flushed by default
* Actions non MRI - use JDK11 on macOS, add Big Sur
* Actions MRI - add macOS Big Sur Ruby 2.7
* test/helper.rb - run setup in same Timeout block as test
* TestIntegrationSingle#test_int_refuse - skip on JRuby
Seems to intermittently lockup CI
* TestLauncher#test_puma_stats - fix intermittent non-MRI failure II
* test_out_of_band_server.rb - JRuby - add small sleep after server.run
* test_persistent.rb - JRuby - add small sleep after server.run
* test_puma_server.rb - JRuby - add small sleep after server.run
Jobs still occasionally freeze/time-out in test step.
1. Allows jruby-head to fail (as done previously)
2. Actions - change all Ubuntu JRuby OS's to 20.04 (18.04 uses JDK-8, 20.04 uses JDK-11)
3. Integration tests (cluster, pumactl, single) - only run parallel on MRI Rubies
4. `helper.rb` - `TestSkips` - add `JRUBY_HEAD` constant for use with non-parallel conditionals and skips
5. `test_puma_server.rb` - jruby-head - run non-parallel
6. `test_puma_server_ssl.rb` - `TestPumaServerSSLClient` tests - non-parallel on JRuby, add `Errno::ECONNRESET` to client net/https rescue for TruffleRuby
7. `test_puma_server_ssl.rb` - `TestPumaServerSSL#test_http_rejection` - add `Net::ReadTimeout` to client net/https rescue for TruffleRuby
Update test_puma_server_ssl.rb
* 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