diff options
Diffstat (limited to 'spec/ruby/library/net/http/http/fixtures/http_server.rb')
-rw-r--r-- | spec/ruby/library/net/http/http/fixtures/http_server.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/ruby/library/net/http/http/fixtures/http_server.rb b/spec/ruby/library/net/http/http/fixtures/http_server.rb index 49e8f437cc..aeb0babda1 100644 --- a/spec/ruby/library/net/http/http/fixtures/http_server.rb +++ b/spec/ruby/library/net/http/http/fixtures/http_server.rb @@ -53,10 +53,10 @@ module NetHTTPSpecs end end - class << self - @server = nil - @server_thread = nil + @server = nil + @server_thread = nil + class << self def port raise "server not started" unless @server @server.config[:Port] @@ -89,8 +89,12 @@ module NetHTTPSpecs if @server begin @server.shutdown - rescue Errno::EPIPE + rescue Errno::EPIPE, Errno::EBADF # Because WEBrick is not thread-safe and only catches IOError + + # EBADF can happen because WEBrick @server_thread concurrently closes the shutdown pipe + # once @status = :Shutdown, while the current thread does write_nonblock("\0"). + # On MRI this EBADF is replaced by IOError due to the GIL around both #close and #write_nonblock. end @server = nil end |