Skip to content

Commit

Permalink
Update gempsec to require nio4r 2.5.5
Browse files Browse the repository at this point in the history
This will address the rare edge case of an application using Puma 6 but
a pre-2.5.5 version of nio4r, which will manifest inconsistent
::NIO::Selector.new behavior.

As cited in
puma#3542 (comment), 2.5.5 is
4 years old now, but this bump of the minimum requirement on the puma
side technically shouldn't hurt.
  • Loading branch information
ning-github committed Jan 29, 2025
1 parent 9cc3888 commit dff1f4a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions lib/puma/reactor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ def initialize(backend, &block)
unless valid_backends.include?(backend)
raise ArgumentError.new("unsupported IO selector backend: #{backend} (available backends: #{valid_backends.join(', ')})")
end
delete_output = NIO::Selector.backends.delete(backend)
if delete_output.nil?
@selector = ::NIO::Selector.new
else
@selector = ::NIO::Selector.new(delete_output)
end

@selector = ::NIO::Selector.new(NIO::Selector.backends.delete(backend))
@input = Queue.new
@timeouts = []
@block = block
Expand Down
2 changes: 1 addition & 1 deletion puma.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.email = ["evan@phx.io"]
s.executables = ["puma", "pumactl"]
s.extensions = ["ext/puma_http11/extconf.rb"]
s.add_runtime_dependency "nio4r", "~> 2.0"
s.add_runtime_dependency "nio4r", "~> 2.5.5"
if RbConfig::CONFIG['ruby_version'] >= '2.5'
s.metadata["msys2_mingw_dependencies"] = "openssl"
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_reactor.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'puma/reactor'
require_relative "helper"

class TestReactor < Minitest::Test
class TestReactor < TimeoutTestCase
def test_initialization_on_jruby
skip_unless :jruby
@reactor = Puma::Reactor.new(:auto) { |c| reactor_wakeup c }
Expand Down

0 comments on commit dff1f4a

Please sign in to comment.