1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Revert "Use SIGWINCH to print thread backtraces

Closes #2201

This reverts commit 3bf45fbf34.
This commit is contained in:
Nate Berkopec 2020-04-02 09:28:44 +09:00
parent dec41f6ca3
commit a6dcb506f2
No known key found for this signature in database
GPG key ID: BDD7A4B8E43906A6
4 changed files with 15 additions and 38 deletions

View file

@ -8,7 +8,6 @@
* `GC.compact` is called before fork if available (#2093)
* Add `requests_count` to workers stats. (#2106)
* Increases maximum URI path length from 2048 to 8196 bytes (#2167)
* Sending SIGWINCH to any Puma worker now prints currently active threads and their backtraces (#2195)
* Force shutdown responses can be overridden by using the `lowlevel_error_handler` config (#2203)
* Deprecations, Removals and Breaking API Changes
@ -28,7 +27,7 @@
* Ensure `BUNDLE_GEMFILE` is unspecified in workers if unspecified in master when using `prune_bundler` (#2154)
* Rescue and log exceptions in hooks defined by users (on_worker_boot, after_worker_fork etc) (#1551)
* Read directly from the socket in #read_and_drop to avoid raising further SSL errors (#2198)
* Refactor
* Remove unused loader argument from Plugin initializer (#2095)
* Simplify `Configuration.random_token` and remove insecure fallback (#2102)

View file

@ -40,7 +40,7 @@ Puma cluster responds to these signals:
- `USR1` restart workers in phases, a rolling restart. This will not reload configuration file.
- `HUP` reopen log files defined in stdout_redirect configuration parameter. If there is no stdout_redirect option provided it will behave like `INT`
- `INT` equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.
- `WINCH` (`INFO` on BSD-based systems) prints a thread backtrace. This is useful for debugging infinite loops or slow performance.
- `CHLD`
## Callbacks order in case of different signals

View file

@ -452,18 +452,13 @@ module Puma
log "*** SIGHUP not implemented, signal based logs reopening unavailable!"
end
begin
Signal.trap "SIGWINCH" do
log_backtrace
end
rescue Exception
log "*** SIGWINCH not implemented, signal based thread backtraces unavailable!"
end
begin
unless Puma.jruby? # INFO in use by JVM already
Signal.trap "SIGINFO" do
log_backtrace
thread_status do |name, backtrace|
@events.log name
@events.log backtrace.map { |bt| " #{bt}" }
end
end
end
rescue Exception
@ -472,13 +467,6 @@ module Puma
end
end
def log_backtrace
thread_status do |name, backtrace|
@events.log name
@events.log backtrace.map { |bt| " #{bt}" }
end
end
def require_rubygems_min_version!(min_version, feature)
return if min_version <= Gem::Version.new(Gem::VERSION)

View file

@ -33,16 +33,18 @@ class TestIntegrationCluster < TestIntegration
end
end
def test_sigwinch_thread_print
skip_unless_signal_exist? :WINCH
signal_thread_backtrace :WINCH
end
def test_siginfo_thread_print
skip_unless_signal_exist? :INFO
signal_thread_backtrace :INFO
cli_server "-w #{WORKERS} -q test/rackup/hello.ru"
worker_pids = get_worker_pids
output = []
t = Thread.new { output << @server.readlines }
Process.kill :INFO, worker_pids.first
Process.kill :INT , @pid
t.join
assert_match "Thread: TID", output.join
end
def test_usr2_restart
@ -133,18 +135,6 @@ class TestIntegrationCluster < TestIntegration
private
def signal_thread_backtrace(signal)
cli_server "-w #{WORKERS} -q test/rackup/hello.ru"
worker_pids = get_worker_pids
output = []
t = Thread.new { output << @server.readlines }
Process.kill signal, worker_pids.first
Process.kill :INT , @pid
t.join
assert_match "Thread: TID", output.join
end
# Send requests 10 per second. Send 10, then :TERM server, then send another 30.
# No more than 10 should throw Errno::ECONNRESET.
def term_closes_listeners(unix: false)