mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix ssl_v3_rejection test hanging (#1567)
* Fix ssl_v3_rejection test hanging When closing the server, puma would get caught in a loop where it would expect IO.select to timeout but instead it would return a file descriptor ready to read, but in a end-of-file condition. * Remove windows tweaks from test_puma_server_ssl.rb So that the hang I'm getting when running the tests locally can be reproduced. * Add missing appveyor entry * Try fix 2.2.9 build * Fix extra package installation on appveyor
This commit is contained in:
parent
2154d116c3
commit
4a7a9be7bd
4 changed files with 27 additions and 23 deletions
21
appveyor.yml
21
appveyor.yml
|
@ -23,7 +23,7 @@ install:
|
|||
7z x -y openssl-1.0.2j-x86-windows.tar -oC:\ruby23\DevKit\mingw &
|
||||
set b_config="--with-ssl-dir=C:/ruby23/DevKit/mingw --with-opt-include=C:/ruby23/DevKit/mingw/include" &
|
||||
set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem &
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm mingw-w64-x86_64-ragel &
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm mingw-w64-i686-ragel &
|
||||
set PATH=%PATH%;C:\msys64\ming32\bin
|
||||
)
|
||||
- if "%ri_file%"=="x64" (
|
||||
|
@ -32,7 +32,7 @@ install:
|
|||
7z x -y openssl-1.0.2j-x64-windows.tar -oC:\ruby23-x64\DevKit\mingw &
|
||||
set b_config="--with-ssl-dir=C:/ruby23-x64/DevKit/mingw --with-opt-include=C:/ruby23-x64/DevKit/mingw/include" &
|
||||
set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem &
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm mingw-w64-i686-ragel &
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm mingw-w64-x86_64-ragel &
|
||||
set PATH=%PATH%;C:\msys64\ming64\bin
|
||||
)
|
||||
- RAKEOPT:
|
||||
|
@ -43,7 +43,12 @@ install:
|
|||
- bundle install --without documentation --path C:/av_bundle
|
||||
|
||||
# Download & install current OpenSSL package for later RubyInstaller2 version(s)
|
||||
- set openssl=mingw-w64-x86_64-openssl-1.1.0.g-1-any.pkg.tar.xz
|
||||
- if %ruby_version%==25-x64 (
|
||||
set openssl=mingw-w64-x86_64-openssl-1.1.0.g-1-any.pkg.tar.xz
|
||||
)
|
||||
- if %ruby_version%==25 (
|
||||
set openssl=mingw-w64-i686-openssl-1.1.0.g-1-any.pkg.tar.xz
|
||||
)
|
||||
- set dl_uri=https://dl.bintray.com/msp-greg/ruby_trunk
|
||||
- if %ruby_version%==25-x64 (
|
||||
C:\msys64\usr\bin\bash -lc "pacman-key -r 77D8FA18 --keyserver na.pool.sks-keyservers.net && pacman-key -f 77D8FA18 && pacman-key --lsign-key 77D8FA18" &
|
||||
|
@ -52,6 +57,13 @@ install:
|
|||
C:\msys64\usr\bin\pacman -Rdd --noconfirm mingw-w64-x86_64-openssl &
|
||||
C:\msys64\usr\bin\pacman -Udd --noconfirm --force C:\%openssl%
|
||||
)
|
||||
- if %ruby_version%==25 (
|
||||
C:\msys64\usr\bin\bash -lc "pacman-key -r 77D8FA18 --keyserver na.pool.sks-keyservers.net && pacman-key -f 77D8FA18 && pacman-key --lsign-key 77D8FA18" &
|
||||
appveyor DownloadFile %dl_uri%/%openssl% -FileName C:\%openssl% &
|
||||
appveyor DownloadFile %dl_uri%/%openssl%.sig -FileName C:\%openssl%.sig &
|
||||
C:\msys64\usr\bin\pacman -Rdd --noconfirm mingw-w64-686-openssl &
|
||||
C:\msys64\usr\bin\pacman -Udd --noconfirm --force C:\%openssl%
|
||||
)
|
||||
|
||||
build_script:
|
||||
- bundle exec rake -rdevkit compile -- %b_config%
|
||||
|
@ -68,6 +80,9 @@ environment:
|
|||
- ruby_version: _trunk
|
||||
b_config: "--use-system-libraries"
|
||||
ri_file: x64_2
|
||||
- ruby_version: 25
|
||||
b_config: "--use-system-libraries"
|
||||
ri_file: x86_2
|
||||
- ruby_version: 25-x64
|
||||
b_config: "--use-system-libraries"
|
||||
ri_file: x64_2
|
||||
|
|
|
@ -124,7 +124,7 @@ module Puma
|
|||
|
||||
def read_and_drop(timeout = 1)
|
||||
return :timeout unless IO.select([@socket], nil, nil, timeout)
|
||||
read_nonblock(1024)
|
||||
return :eof unless read_nonblock(1024)
|
||||
:drop
|
||||
rescue Errno::EAGAIN
|
||||
# do nothing
|
||||
|
@ -141,7 +141,7 @@ module Puma
|
|||
# Don't let this socket hold this loop forever.
|
||||
# If it can't send more packets within 1s, then give up.
|
||||
while should_drop_bytes?
|
||||
return if read_and_drop(1) == :timeout
|
||||
return if [:timeout, :eof].include?(read_and_drop(1))
|
||||
end
|
||||
rescue IOError, SystemCallError
|
||||
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
|
||||
|
|
|
@ -250,7 +250,12 @@ module Puma
|
|||
STDERR.puts "Exception handling servers: #{e.message} (#{e.class})"
|
||||
STDERR.puts e.backtrace
|
||||
ensure
|
||||
@check.close
|
||||
begin
|
||||
@check.close
|
||||
rescue
|
||||
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
|
||||
end
|
||||
|
||||
@notify.close
|
||||
|
||||
if @status != :restart and @own_binder
|
||||
|
|
|
@ -47,18 +47,12 @@ class TestPumaServerSSL < Minitest::Test
|
|||
@http = Net::HTTP.new host, port
|
||||
@http.use_ssl = true
|
||||
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
@no_teardown = false
|
||||
end
|
||||
|
||||
def teardown
|
||||
return if DISABLE_SSL || @no_teardown
|
||||
return if DISABLE_SSL
|
||||
@http.finish if @http.started?
|
||||
@server.stop(true)
|
||||
ensure
|
||||
if windows? && @ssl_listener && !@ssl_listener.closed?
|
||||
@ssl_listener.close
|
||||
@ssl_listener = nil
|
||||
end
|
||||
end
|
||||
|
||||
def test_url_scheme_for_https
|
||||
|
@ -117,13 +111,6 @@ class TestPumaServerSSL < Minitest::Test
|
|||
unless Puma.jruby?
|
||||
assert_match(/wrong version number|no protocols available/, @events.error.message) if @events.error
|
||||
end
|
||||
if windows?
|
||||
@http.finish if @http.started?
|
||||
@http = nil
|
||||
@server.thread.kill
|
||||
@server = nil
|
||||
@no_teardown = true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -180,9 +167,6 @@ class TestPumaServerSSLClient < Minitest::Test
|
|||
end
|
||||
|
||||
server.stop(true)
|
||||
if windows? && ssl_listener && !ssl_listener.closed?
|
||||
ssl_listener.close
|
||||
end
|
||||
end
|
||||
|
||||
def test_verify_fail_if_no_client_cert
|
||||
|
|
Loading…
Add table
Reference in a new issue