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

Fix recursive prune_bundler

Resolve #2319
This commit is contained in:
Alexander Popov 2020-07-27 15:02:11 +03:00
parent df57cecce5
commit 39f9c72d93
No known key found for this signature in database
GPG key ID: 9CF7623B5A63EDAA
5 changed files with 60 additions and 0 deletions

View file

@ -2,6 +2,7 @@
* Bugfixes
* Resolve issue with threadpool waiting counter decrement when thread is killed
* Constrain rake-compiler version to 0.9.4 to fix `ClassNotFound` exception when using MiniSSL with Java8.
* Fix recursive `prune_bundler` (#2319).
## 5.0.0

View file

@ -288,6 +288,7 @@ module Puma
end
def prune_bundler
return if ENV['PUMA_BUNDLER_PRUNED']
return unless defined?(Bundler)
require_rubygems_min_version!(Gem::Version.new("2.2"), "prune_bundler")
unless puma_wild_location

View file

@ -0,0 +1,14 @@
require 'bundler/setup'
Bundler.setup
prune_bundler true
workers 2
app do |env|
[200, {}, ["embedded app"]]
end
lowlevel_error_handler do |err|
[200, {}, ["error page"]]
end

View file

@ -198,6 +198,30 @@ RUBY
assert output, "Friendly fork didn't run"
end
def test_prune_bundler_with_multiple_workers
cli_server "", config: <<RUBY
require 'bundler/setup'
Bundler.setup
prune_bundler true
workers 2
app do |env|
[200, {}, ["embedded app"]]
end
lowlevel_error_handler do |err|
[200, {}, ["error page"]]
end
RUBY
connection = connect
reply = read_body(connection)
assert reply, "embedded app"
end
private
def worker_timeout(timeout, iterations, config)

View file

@ -90,6 +90,26 @@ class TestIntegrationPumactl < TestIntegration
@server = nil
end
def test_prune_bundler_with_multiple_workers
skip NO_FORK_MSG unless HAS_FORK
cli_server "-q -C test/config/prune_bundler_with_multiple_workers.rb --control-url unix://#{@control_path} --control-token #{TOKEN} -S #{@state_path}", unix: true
s = UNIXSocket.new @bind_path
@ios_to_close << s
s << "GET / HTTP/1.0\r\n\r\n"
body = s.read
assert_match "200 OK", body
assert_match "embedded app", body
cli_pumactl "stop", unix: true
_, status = Process.wait2(@pid)
@server = nil
end
def test_kill_unknown
skip_on :jruby