JRuby

Webrick doesn't start in https

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: JRuby-OpenSSL 0.5.1
  • Component/s: OpenSSL
  • Labels:
    None
  • Environment:
    windows vista / ubuntu, jdk 1.6, jruby trunk and 1.2
  • Number of attachments :
    2

Description

Webrick fails to start in jruby using https. In Rails 2.2.x, the attached patch would make it work, although wih some warning messages.

From 2.3 onwards, this patch no longer helps. We are working on a temporary fix, but this seems like an openssl issue.

Activity

Hide
Charles Oliver Nutter added a comment -

I'm pushing 0.5 today, but we can revisit this in the future. Do you have a newer patch or hack? What's the error?

Show
Charles Oliver Nutter added a comment - I'm pushing 0.5 today, but we can revisit this in the future. Do you have a newer patch or hack? What's the error?
Hide
Ricardo Trindade added a comment -

The error I get is below. Starting webrick in https requires a slightly different script/server than is shipped with standard rails, but there are several examples in articles, blog posts, etc... Ours is customized for a specific usage scenario, but if you don't have one, I can simplify ours into a form that makes it easy to reproduce the bug.

Exception in thread "Rais Startup" file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/ssl.rb:91:in `listen': can't convert nil into String (TypeError)
from file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/server.rb:63:in `initialize'
from file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/httpserver.rb:24:in `initialize'
from C:/codigo/xpto/gui/rails/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:9:in `run'
from /C:/codigo/xpto/gui/rails/script/server.rb:73:in `start_webrick'
from /C:/codigo/xpto/gui/rails/rails-embedding.rb:35:in `init_embedded_rails_webrick'
from /C:/codigo/xpto/gui/rails/utils.rb:41:in `call'
from /C:/codigo/xpto/gui/rails/utils.rb:41:in `run'
from :1
...internal jruby stack elided...
from WEBrick::GenericServer.listen(file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/server.rb:63)
from WEBrick::GenericServer.initialize(file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/httpserver.rb:24)
from WEBrick::HTTPServer.initialize(C:/codigo/xpto/gui/rails/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:9)
from #<Class:01x12ef170>.run(/C:/codigo/xpto/gui/rails/script/server.rb:73)
from Object.start_webrick(/C:/codigo/xpto/gui/rails/rails-embedding.rb:35)
from #<Class:01x198ee2f>.init_embedded_rails_webrick(/C:/codigo/xpto/gui/rails/utils.rb:41)
from Proc.call(/C:/codigo/xpto/gui/rails/utils.rb:41)
from #<Class:01x11f2158>.run(:1)
from (unknown).(unknown)(:1)

Show
Ricardo Trindade added a comment - The error I get is below. Starting webrick in https requires a slightly different script/server than is shipped with standard rails, but there are several examples in articles, blog posts, etc... Ours is customized for a specific usage scenario, but if you don't have one, I can simplify ours into a form that makes it easy to reproduce the bug. Exception in thread "Rais Startup" file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/ssl.rb:91:in `listen': can't convert nil into String (TypeError) from file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/server.rb:63:in `initialize' from file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/httpserver.rb:24:in `initialize' from C:/codigo/xpto/gui/rails/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:9:in `run' from /C:/codigo/xpto/gui/rails/script/server.rb:73:in `start_webrick' from /C:/codigo/xpto/gui/rails/rails-embedding.rb:35:in `init_embedded_rails_webrick' from /C:/codigo/xpto/gui/rails/utils.rb:41:in `call' from /C:/codigo/xpto/gui/rails/utils.rb:41:in `run' from :1 ...internal jruby stack elided... from WEBrick::GenericServer.listen(file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/server.rb:63) from WEBrick::GenericServer.initialize(file:/C:/codigo/xpto/libs/runtime/jruby-complete.jar!/webrick/httpserver.rb:24) from WEBrick::HTTPServer.initialize(C:/codigo/xpto/gui/rails/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:9) from #<Class:01x12ef170>.run(/C:/codigo/xpto/gui/rails/script/server.rb:73) from Object.start_webrick(/C:/codigo/xpto/gui/rails/rails-embedding.rb:35) from #<Class:01x198ee2f>.init_embedded_rails_webrick(/C:/codigo/xpto/gui/rails/utils.rb:41) from Proc.call(/C:/codigo/xpto/gui/rails/utils.rb:41) from #<Class:01x11f2158>.run(:1) from (unknown).(unknown)(:1)
Hide
Charles Oliver Nutter added a comment -

Ok, first I need you to confirm if this is still a problem with JRuby master and jruby-openssl-0.5. Then we need to talk more about why this is happening and find a simple way for us to reproduce it. It's probably an OpenSSL issue, but it's hard to say right now.

Show
Charles Oliver Nutter added a comment - Ok, first I need you to confirm if this is still a problem with JRuby master and jruby-openssl-0.5. Then we need to talk more about why this is happening and find a simple way for us to reproduce it. It's probably an OpenSSL issue, but it's hard to say right now.
Hide
Ricardo Trindade added a comment -

I just confirmed that the same error (with similar stacktrace) occurs with jruby master and jruby-openssl-0.5 (from github).

Show
Ricardo Trindade added a comment - I just confirmed that the same error (with similar stacktrace) occurs with jruby master and jruby-openssl-0.5 (from github).
Hide
Charles Oliver Nutter added a comment -

Ok, I'll tell you what...I'll try to get this fixed over the weekend if someone tosses me a dummy app, dummy cert, and instructions for how to run it.

Show
Charles Oliver Nutter added a comment - Ok, I'll tell you what...I'll try to get this fixed over the weekend if someone tosses me a dummy app, dummy cert, and instructions for how to run it.
Hide
Brice Figureau added a comment -

This patch (and test) should fix this issue.
It doesn't replicate MRI openssl output, but should be enough.

Webrick was crashing trying to display the server cert text. Unfortunately OpenSSL::X509::Certificate#to_text was returning nil.

Show
Brice Figureau added a comment - This patch (and test) should fix this issue. It doesn't replicate MRI openssl output, but should be enough. Webrick was crashing trying to display the server cert text. Unfortunately OpenSSL::X509::Certificate#to_text was returning nil.
Hide
Charles Oliver Nutter added a comment -

Hey, thanks again Brice! I've applied your fix in 516ce27, but I had to make the test be a simple "not_nil" check since your text doesn't take into consideration the timezone where it's being run. If you can fix that, we can re-enable the test that confirms text as well.

Show
Charles Oliver Nutter added a comment - Hey, thanks again Brice! I've applied your fix in 516ce27, but I had to make the test be a simple "not_nil" check since your text doesn't take into consideration the timezone where it's being run. If you can fix that, we can re-enable the test that confirms text as well.

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: