Project

General

Profile

Bug #10478

WEBrick's server.rb contains a return that should be a break

Added by headius (Charles Nutter) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
trunk
[ruby-core:66085]

Description

Commit 46253 (git hash 6f226d9) added the ability to shut down the running WEBrick server more gracefully, by monitoring a shutdown pipe. However, the logic to actually escape the server loop was written to use "return" instead of break", which causes a LocalJumpError when run inside a threaded server:

1) Error:
TestNetHTTPContinue#test_expect_continue:
LocalJumpError: unexpected return
/Users/headius/projects/jruby/lib/ruby/stdlib/webrick/server.rb:216:in `start'

It is not entirely clear why this does not show up for MRI running the same tests (JRuby master is now running MRI trunk stdlib and tests), but we believe this return should be a "break". A break here exits the server loop and allows the rest of the server logic to finish gracefully without an error bubbling out.

We have made this change in JRuby here: https://github.com/jruby/jruby/commit/ce7e292dcc899111a908467f90fd0c639cfbba18

I am marking this urgent, because MRI 2.2 is almost done, and JRuby plans to release shortly after with expected 2.2 compatibility.

Assigning to akr because he did the original commit.

Associated revisions

Revision a0e4956d
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Revision 48285
Added by akr (Akira Tanaka) over 4 years ago

  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

History

Updated by akr (Akira Tanaka) over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r48285.


  • lib/webrick/server.rb: Stop lisntner loop properly. [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.

Updated by akr (Akira Tanaka) over 4 years ago

Thank you for the fix.

I investigated why the LocalJumpError doesn't cause test errors.
It is because the method rescue StandardError which is the super class of LocalJumpError.
So the LocalJumpError doesn't propagated.

Updated by headius (Charles Nutter) over 4 years ago

Ahh that explains the lost exception. We will investigate why the LJE managed to escape on JRuby.

Also available in: Atom PDF