rack 1.3.0 jruby 1.6.2 WEBrick error #177

Closed
frazerh opened this Issue May 28, 2011 · 4 comments

Comments

Projects
None yet
3 participants

frazerh commented May 28, 2011

I was unable to start a simple sinatra hello world app

rvm jruby 1.6.2
rack (1.3.0)
sinatra (1.2.6)

[2011-05-28 11:06:04] INFO  WEBrick 1.3.1
[2011-05-28 11:06:05] INFO  ruby 1.9.2 (2011-05-23) [java]
[2011-05-28 11:06:05] INFO  WEBrick::HTTPServer#start: pid=71679 port=4567
0:0:0:0:0:0:0:1%0 - - [28/May/2011 11:06:58] "GET / HTTP/1.1" 200 - 0.0700
[2011-05-28 11:06:58] ERROR NoMethodError: undefined method `split' for nil:NilClass
    /Users/frazer/.rvm/gems/jruby-1.6.2@sinatra/gems/rack-1.3.0/lib/rack/handler/webrick.rb:68:in `service'
    /Users/frazer/.rvm/gems/jruby-1.6.2@sinatra/gems/rack-1.3.0/lib/rack/utils.rb:349:in `each'
    org/jruby/RubyHash.java:1174:in `each'
    /Users/frazer/.rvm/gems/jruby-1.6.2@sinatra/gems/rack-1.3.0/lib/rack/utils.rb:348:in `each'
    /Users/frazer/.rvm/gems/jruby-1.6.2@sinatra/gems/rack-1.3.0/lib/rack/handler/webrick.rb:62:in `service'
    /Users/frazer/.rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/httpserver.rb:111:in `service'
    /Users/frazer/.rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/httpserver.rb:70:in `run'
    /Users/frazer/.rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/server.rb:183:in `start_thread'
0:0:0:0:0:0:0:1%0 - - [28/May/2011:11:06:58 EDT] "GET / HTTP/1.1" 500 321

Reverting to rack 1.2.3 resolves the above.

Hope this is somewhat helpful

Member

rkh commented May 28, 2011

Unable to reproduce this (100% the same stack). Could you give me your code?

ahmeij commented May 30, 2011

I have the same issue:

[2011-05-30 13:16:31] ERROR NoMethodError: undefined method `split' for nil:NilClass
    /usr/local/rvm/gems/jruby-1.6.2@matcher/gems/rack-1.3.0/lib/rack/handler/webrick.rb:68:in `service'
    org/jruby/RubyHash.java:1174:in `each'
    /usr/local/rvm/gems/jruby-1.6.2@matcher/gems/rack-1.3.0/lib/rack/handler/webrick.rb:62:in `service'
    /usr/local/rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/httpserver.rb:111:in `service'
    /usr/local/rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/httpserver.rb:70:in `run'
    /usr/local/rvm/rubies/jruby-1.6.2/lib/ruby/1.9/webrick/server.rb:183:in `start_thread'
0:0:0:0:0:0:0:1 - - [30/May/2011:13:16:31 CEST] "GET /network_size HTTP/1.1" 500 321

extract of the code involved:

require 'sinatra/base'

module Endpoints
  class HTTP < Sinatra::Base
    set :environment, :production

    post '/query' do
      matches = some_app_magic_here
      content_type "text/plain"
      YAML::dump(matches)
    end
  end
end
Member

rkh commented May 30, 2011

Cannot reproduce with the following code:

require 'sinatra/base'
require 'yaml'

module Endpoints
  class HTTP < Sinatra::Base
    set :environment, :production
    set :server, 'webrick'

    post '/query' do
      content_type :txt
      YAML.dump params
    end
  end
end

Neither with rackup nor with Endpoint::HTTP.run!.

Log:

== Sinatra/1.2.6 has taken the stage on 4567 for production with backup from WEBrick
[2011-05-30 18:10:46] INFO  WEBrick 1.3.1
[2011-05-30 18:10:46] INFO  ruby 1.8.7 (2011-05-23) [java]
[2011-05-30 18:10:46] INFO  WEBrick::HTTPServer#start: pid=54550 port=4567
localhost - - [30/May/2011:18:11:06 CEST] "POST /query HTTP/1.1" 200 15
- -> /query

Example query:

~ ☯ curl -d a=b -d c=d http://localhost:9292/query
--- 
a: b
c: d

rvm info:

jruby-1.6.2:

  system:
    uname:       "Darwin sd-24.stud.uni-potsdam.de 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386"
    bash:        "/usr/local/bin/bash => GNU bash, version 4.2.10(2)-release (i386-apple-darwin10.7.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.6.16 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "jruby"
    version:      "1.6.2"
    date:         "2011-05-23"
    platform:     "darwin-x86_64-java"
    patchlevel:   "TM"
    full_version: "jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [darwin-x86_64-java]"

  homes:
    gem:          "/Users/konstantin/.rvm/gems/jruby-1.6.2"
    ruby:         "/Users/konstantin/.rvm/rubies/jruby-1.6.2"

  binaries:
    ruby:         "/Users/konstantin/.rvm/rubies/jruby-1.6.2/bin/ruby"
    irb:          "/Users/konstantin/.rvm/rubies/jruby-1.6.2/bin/irb"
    gem:          "/Users/konstantin/.rvm/rubies/jruby-1.6.2/bin/gem"
    rake:         "/Users/konstantin/.rvm/gems/jruby-1.6.2/bin/rake"

  environment:
    PATH:         "/Users/konstantin/.rvm/gems/jruby-1.6.2/bin:/Users/konstantin/.rvm/gems/jruby-1.6.2@global/bin:/Users/konstantin/.rvm/rubies/jruby-1.6.2/bin:/Users/konstantin/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Users/konstantin/Workspace/jaql/bin:/Users/konstantin/Repositories/hadoop-0.18.3/bin:/Users/konstantin/Repositories/jaql-0.4/bin:/usr/local/bin:/usr/llvm-gcc-4.2/bin:/usr/X11R6/bin:/usr/X11/bin:/usr/local/*/bin:/Users/konstantin/ruby_tools/*/bin:/Users/konstantin/bin:/Users/konstantin/.bin:/Users/konstantin/.local/bin:/Users/konstantin/gtk/inst/bin:/Users/konstantinhaase/Workspace/dotfiles/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/local/Cellar/python/2.7/bin:/Developer/usr/bin:/usr/sbin:/usr/bin:/usr/ucb:/bin:/sbin:/opt/bin:.:/home/hadoop/hadoop/bin/:/Users/konstantin/.rip/active/bin"
    GEM_HOME:     "/Users/konstantin/.rvm/gems/jruby-1.6.2"
    GEM_PATH:     "/Users/konstantin/.rvm/gems/jruby-1.6.2:/Users/konstantin/.rvm/gems/jruby-1.6.2@global"
    MY_RUBY_HOME: "/Users/konstantin/.rvm/rubies/jruby-1.6.2"
    IRBRC:        "/Users/konstantin/.rvm/rubies/jruby-1.6.2/.irbrc"
    RUBYOPT:      "-rubygems"
    gemset:       ""

Installed gems:

~ ☯ gem list

*** LOCAL GEMS ***

bouncy-castle-java (1.5.0146.1)
bundler (1.0.14)
jruby-launcher (1.0.7 java)
jruby-openssl (0.7.4)
rack (1.3.0)
rake (0.8.7)
sinatra (1.2.6)
sources (0.0.1)
tilt (1.3.2)

What's different?

Member

rkh commented Jun 16, 2011

Can reproduce it with this code on JRuby 1.6.2:

require 'sinatra'

get '/' do
  'hi'
end

get '/long' do
  content_type 'text/html'
  'hi'
end

get '/short' do
  content_type :html
  'hi'
end

rkh closed this in d0e8aed Jun 16, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment