mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
cluster.rb - no zombies (#1887)
* cluster.rb - fixup for Cluster#check_workers, removes zombies? * test_integration.rb - add zombie test Co-authored-by: Matt Duszynski <mattduszynski@gmail.com> * travis.yml - misc updates jruby-head to bionic xcode10.2 to xcode11 all ruby 2.2 to 2.2.10
This commit is contained in:
parent
be13b96885
commit
b32de94ee6
3 changed files with 34 additions and 10 deletions
18
.travis.yml
18
.travis.yml
|
@ -37,25 +37,27 @@ rvm:
|
|||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- rvm: 2.2
|
||||
dist: trusty
|
||||
- rvm: 2.2.10
|
||||
dist: trusty
|
||||
env: OS="Trusty 14.04 OpenSSL 1.0.1"
|
||||
- rvm: 2.6
|
||||
- rvm: 2.6.3
|
||||
dist: bionic
|
||||
env: OS="Bionic 18.04 OpenSSL 1.1.1"
|
||||
- rvm: ruby-head
|
||||
env: jit=yes
|
||||
- rvm: 2.4.6
|
||||
os: osx
|
||||
osx_image: xcode10.2
|
||||
env: OS="osx xcode10.2"
|
||||
osx_image: xcode11
|
||||
env: OS="osx xcode11"
|
||||
- rvm: 2.5.5
|
||||
os: osx
|
||||
osx_image: xcode10.2
|
||||
env: OS="osx xcode10.2"
|
||||
osx_image: xcode11
|
||||
env: OS="osx xcode11"
|
||||
- rvm: jruby-9.2.7.0
|
||||
env: JRUBY_OPTS="--debug" JAVA_OPTS="--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist --add-opens java.base/java.util.zip=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.security.cert=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
|
||||
- rvm: jruby-head
|
||||
dist: bionic
|
||||
env: OS="Bionic 18.04"
|
||||
|
||||
allow_failures:
|
||||
- rvm: ruby-head
|
||||
|
@ -63,6 +65,8 @@ matrix:
|
|||
env: jit=yes
|
||||
- rvm: jruby-9.2.7.0
|
||||
- rvm: jruby-head
|
||||
dist: bionic
|
||||
env: OS="Bionic 18.04"
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
|
@ -227,9 +227,11 @@ module Puma
|
|||
# during this loop by giving the kernel time to kill them.
|
||||
sleep 1 if any
|
||||
|
||||
@workers.reject! { |w| Process.waitpid(w.pid, Process::WNOHANG) }
|
||||
|
||||
@workers.reject!(&:dead?)
|
||||
pids = []
|
||||
while pid = Process.waitpid(-1, Process::WNOHANG) do
|
||||
pids << pid
|
||||
end
|
||||
@workers.reject! { |w| w.dead? || pids.include?(w.pid) }
|
||||
|
||||
cull_workers
|
||||
spawn_workers
|
||||
|
|
|
@ -374,4 +374,22 @@ class TestIntegration < Minitest::Test
|
|||
Process.wait(@server.pid)
|
||||
@server = nil # prevent `#teardown` from killing already killed server
|
||||
end
|
||||
|
||||
def test_no_zombie_children
|
||||
skip NO_FORK_MSG unless HAS_FORK
|
||||
|
||||
worker_pids = []
|
||||
server = server("-w 2 test/rackup/hello.ru")
|
||||
# Get the PIDs of the child workers.
|
||||
while worker_pids.size < 2
|
||||
next unless line = server.gets.match(/pid: (\d+)/)
|
||||
worker_pids << line.captures.first.to_i
|
||||
end
|
||||
# Signal the workers to terminate, and wait for them to die.
|
||||
worker_pids.each { |pid| Process.kill :TERM, pid }
|
||||
sleep 2
|
||||
|
||||
# Should return nil if Puma has correctly cleaned up
|
||||
assert_nil Process.waitpid(-1, Process::WNOHANG)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue