Specifying an invalid/not installed server continues silently, without warning #379

Closed
perlun opened this Issue Apr 25, 2012 · 2 comments

Comments

Projects
None yet
2 participants

perlun commented Apr 25, 2012

I'm currently doing a Mizuno handler for Rack, but one thing that puzzled me a bit while looking at how to do this was the fact that code like this:

  server = Rack::Server.new(
    :server => 'mizuno',
    :config => 'config.ru'
    )
  server.start

...I don't get one single line of output stating that mizuno is not a supported server. (Mizuno is not set up as a registered handler in rack/handler.rb at this point)

Also, if I change :server to 'thin' (which is supported by means of autoload), I still get absolutely no warning/indication that it failed to use thin. It just defaults to use WEBRick, which is alright per se, but I believe it would make quite a lot of sense to indicate that the server of choice was not available, and that Rack has fallen back to use WEBRick instead.

perlun commented Apr 25, 2012

This is quite clearly an error on my behalf. :-( My config.ru had invalid code in it, which actually called instance.run() on a Sinatra-based class => Sinatra tried to start up Rack, out of my control, basically ignoring the server specification that I was trying to override. My bad. I'm now getting a much more sane error instead. Will close this issue now.

LoadError: no such file to load -- thin
                 require at org/jruby/RubyKernel.java:1042
                 require at C:/Work/hg/eCraft.appFactory/jruby/jruby-1.6.7-32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
                  (root) at C:/Work/hg/eCraft.appFactory/core/gems/gems/rack-1.4.1/lib/rack/handler/thin.rb:1
               const_get at org/jruby/RubyModule.java:2578
                     get at C:/Work/hg/eCraft.appFactory/core/gems/gems/rack-1.4.1/lib/rack/handler/thin.rb:21
                    each at org/jruby/RubyArray.java:1615
                  inject at org/jruby/RubyEnumerable.java:830
                     get at C:/Work/hg/eCraft.appFactory/core/gems/gems/rack-1.4.1/lib/rack/handler.rb:21
                  server at C:/Work/hg/eCraft.appFactory/core/gems/gems/rack-1.4.1/lib/rack/server.rb:272
                   start at C:/Work/hg/eCraft.appFactory/core/gems/gems/rack-1.4.1/lib/rack/server.rb:267
  start_mxfactory_server at mxfactory_startup.rb:61
                  (root) at mxfactory_startup.rb:72

@perlun perlun closed this Apr 25, 2012

Contributor

lgierth commented Apr 25, 2012

Tried to reproduce this, #start fails hard for me, as expected:

$ bundle console
1.9.3p125 :001 > require "rack"
 => true 
1.9.3p125 :002 > server = Rack::Server.new(:server => "asdf", :config => "config.ru")
 => #<Rack::Server:0xa089e18 @options={:server=>"asdf", :config=>"config.ru"}> 
1.9.3p125 :003 > server.start
LoadError: cannot load such file -- rack/handler/asdf
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@hatetepe/gems/rack-1.4.1/lib/rack/handler.rb:63:in `require'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@hatetepe/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@hatetepe/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@hatetepe/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@hatetepe/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
    from (irb):3
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/lib/bundler/cli.rb:497:in `console'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.1/bin/bundle:13:in `<top (required)>'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/bin/bundle:19:in `load'
    from /home/lars/.rvm/gems/ruby-1.9.3-p125@global/bin/bundle:19:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment