Project

General

Profile

Actions

Bug #11742

closed

lib/webrick/utils.rb:196:in `register': ERROR RuntimeError: can't add a new key into hash during iteration

Added by ngoto (Naohisa Goto) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Target version:
-
[ruby-dev:49387]

Description

RubyCI上にて、たまに以下のFailureが発生しています。

  1) Failure:
TestNetHTTP_v1_2_chunked#test_set_form [/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/test/net/http/test_http.rb:679]:
Expected /\A--(?<boundary>\S+)/ to match "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<HTML>\n  <HEAD><TITLE>Internal Server Error</TITLE></HEAD>\n  <BODY>\n    <H1>Internal Server Error</H1>\n    can't add a new key into hash during iteration\n    <HR>\n    <ADDRESS>\n     WEBrick/1.3.1 (Ruby/2.3.0/2015-11-26) OpenSSL/1.0.1p at\n     127.0.0.1:46098\n    </ADDRESS>\n  </BODY>\n</HTML>\n".

  2) Failure:
TestNetHTTP_v1_2_chunked#test_set_form [/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/test/net/http/utils.rb:46]:
<[]> expected but was
<["[2015-11-26 03:54:25] ERROR RuntimeError: can't add a new key into hash during iteration\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/utils.rb:196:in `register'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/utils.rb:139:in `block in register'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/utils.rb:138:in `synchronize'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/utils.rb:138:in `register'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/utils.rb:227:in `timeout'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:519:in `_read_data'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:530:in `read_line'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:491:in `read_chunk_size'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:510:in `read_chunked'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:470:in `read_body'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httprequest.rb:255:in `body'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/test/net/http/utils.rb:91:in `do_POST'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httpservlet/abstract.rb:106:in `service'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httpserver.rb:139:in `service'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/httpserver.rb:95:in `run'\n\t/home/rubyci/unstable11s/tmp/build/20151126T012513Z/ruby/lib/webrick/server.rb:295:in `block in start_thread'\n"]>.

上記は Solaris 11 sparc ですが、他のOS・アーキテクチャでも発生しているときがあるようです。

@timeout_info へのアクセスの排他制御が考慮されていないように見えます。
initializeメソッド内で起動されるスレッド @watcher 内で @timeout_info.each {|thread, ary| を回しているのと、registerメソッド内冒頭で @timeout_info[thread] ||= Array.new しているのが、同時に発生したときにエラーが出る?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0