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

Combine PR's #1437, 44, & 63 (#1464)

This commit is contained in:
MSP-Greg 2017-11-20 07:24:02 -06:00 committed by Nate Berkopec
parent 998882ed40
commit 7165775970
5 changed files with 31 additions and 20 deletions

View file

@ -13,6 +13,6 @@ gem "jruby-openssl", :platform => "jruby"
gem "rubocop", "~> 0.49.1"
if %w(2.2.8 2.3.4 2.4.1).include? RUBY_VERSION
if %w(2.2.7 2.2.8 2.3.4 2.4.1).include? RUBY_VERSION
gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"]
end

View file

@ -217,11 +217,14 @@ Some platforms do not support all Puma features.
## Known Bugs
For MRI versions 2.2.7, 2.3.4 and 2.4.1, you may see ```stream closed in another thread (IOError)```. It may be caused by a [Ruby bug](https://bugs.ruby-lang.org/issues/13632). It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:
For MRI versions 2.2.7, 2.2.8, 2.3.4 and 2.4.1, you may see ```stream closed in another thread (IOError)```. It may be caused by a [Ruby bug](https://bugs.ruby-lang.org/issues/13632). It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:
```ruby
if %w(2.2.7 2.3.4 2.4.1).include? RUBY_VERSION
gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"]
if %w(2.2.7 2.2.8 2.3.4 2.4.1).include? RUBY_VERSION
begin
require 'stopgap_13632'
rescue LoadError
end
end
```

View file

@ -24,7 +24,7 @@ module Puma
@workers.each { |x| x.term }
begin
Process.waitall
@workers.each { |w| Process.waitpid(w.pid) }
rescue Interrupt
log "! Cancelled waiting for workers"
end

View file

@ -1,3 +1,8 @@
begin
require 'io/wait'
rescue LoadError
end
module Puma
module MiniSSL
class Socket
@ -43,19 +48,20 @@ module Puma
output = engine_read_all
return output if output
if /mswin|mingw/ !~ RUBY_PLATFORM
data = @socket.read_nonblock(size)
else
begin
data = @socket.read_nonblock(size)
rescue IO::WaitReadable
IO.select([@socket.to_io])
retry
rescue IO::WaitWritable
IO.select(nil, [@socket.to_io])
retry
begin
data = @socket.read_nonblock(size, exception: false)
if data == :wait_readable || data == :wait_writable
if @socket.to_io.respond_to?(data)
@socket.to_io.__send__(data)
elsif data == :wait_readable
IO.select([@socket.to_io])
else
IO.select(nil, [@socket.to_io])
end
else
break
end
end
end while true
@engine.inject(data)
output = engine_read_all

View file

@ -1,9 +1,11 @@
# Copyright (c) 2011 Evan Phoenix
# Copyright (c) 2005 Zed A. Shaw
begin
require 'stopgap_13632' if %w(2.2.7 2.3.4 2.4.1).include? RUBY_VERSION
rescue LoadError
if %w(2.2.7 2.2.8 2.3.4 2.4.1).include? RUBY_VERSION
begin
require 'stopgap_13632'
rescue LoadError
end
end
begin