ruby-changes:48964
From: normal <ko1@a...>
Date: Sat, 9 Dec 2017 03:52:02 +0900 (JST)
Subject: [ruby-changes:48964] normal:r61083 (trunk): webrick: allow shutdown after StartCallback
normal 2017-12-09 03:51:56 +0900 (Sat, 09 Dec 2017) New Revision: 61083 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61083 Log: webrick: allow shutdown after StartCallback We must to ensure the @status ivar is set to :Running before running StartCallback, otherwise Webrick::Server#stop will not change the @status to :Shutdown properly. Note: I have not been able to reproduce the original issue but understood at least part of the problem and fixed it with this commit. However, the original reporter (Peak Xu) was still able to reproduce the problem on 1.9.2 p180 on Windows, so I'm not sure what else might be going on. Ruby threading and synchronization primitives have changed a lot since 1.9.2, so maybe that was fixed elsewhere. * lib/webrick/server.rb: call StartCallback sooner [Bug #4841] Modified files: trunk/lib/webrick/server.rb Index: lib/webrick/server.rb =================================================================== --- lib/webrick/server.rb (revision 61082) +++ lib/webrick/server.rb (revision 61083) @@ -157,12 +157,12 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/server.rb#L157 server_type.start{ @logger.info \ "#{self.class}#start: pid=#{$$} port=#{@config[:Port]}" + @status = :Running call_callback(:StartCallback) shutdown_pipe = @shutdown_pipe thgroup = ThreadGroup.new - @status = :Running begin while @status == :Running begin -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/