Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recursive prune_bundler #2323

Merged
merged 2 commits into from Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Expand Up @@ -4,6 +4,7 @@
* Improve shutdown reliability (#2312)
* 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).
* Ensure that TCP_CORK is usable

## 5.0.0
Expand Down
1 change: 1 addition & 0 deletions lib/puma/launcher.rb
Expand Up @@ -288,6 +288,7 @@ def puma_wild_location
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
Expand Down
14 changes: 14 additions & 0 deletions test/config/prune_bundler_with_multiple_workers.rb
@@ -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
24 changes: 24 additions & 0 deletions test/test_integration_cluster.rb
Expand Up @@ -198,6 +198,30 @@ def test_nakayoshi
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)
Expand Down
20 changes: 20 additions & 0 deletions test/test_integration_pumactl.rb
Expand Up @@ -90,6 +90,26 @@ def test_phased_restart_cluster
@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

Expand Down