postrank-labs / goliath

Goliath is a non-blocking Ruby web server framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

goliath websocket example crashes when using jruby

durkb opened this issue · comments

goliath websocket example crashes when using jruby

source: goliath/examples/websocket.rb
platform: ubuntu 12.10 64bit
browser: chromium Version 22.0.1229.94 Ubuntu 12.10 (161065)
java:
jruby 1.7.2 (and earlier)
OpenJDK Runtime Environment (IcedTea7 2.3.3) (7u9-2.3.3-0ubuntu1~12.10.1)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

gems:
em-http-request (1.0.3)
em-mongo (0.4.3)
em-socksify (0.2.1)
em-synchrony (1.0.2)
em-websocket (0.3.8)
em-websocket-client (0.1.1)
erubis (2.7.0)
eventmachine (1.0.0 java)
goliath (1.0.1, 1.0.0)
haml (3.1.7)
http_parser.rb (0.5.3 java)
tilt (1.3.3)
websocket (1.0.6)

test:
Initial screen is presented in browser. Clicking submit-button results in the following screen:

Nick    anon
Message  please, do not crash this time   
connected...

socket closed

The server-side shows an error:

/home/dirk/.rvm/rubies/jruby-1.7.2/bin/jruby --1.9 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/dirk/RubymineProjects/ws1/goliath/examples/websocket.rb -sv
[21544:INFO] 2013-01-09 10:49:08 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
[21544:INFO] 2013-01-09 10:49:14 :: Status: 200, Content-Length: 1333, Response Time: 613.00ms
[21544:INFO] 2013-01-09 10:49:14 :: WS CLOSED
[21544:INFO] 2013-01-09 10:49:15 :: WS OPEN
NoMethodError: undefined method `parse' for nil:NilClass
       post_init at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/connection.rb:44
            call at org/jruby/RubyProc.java:249
              << at org/ruby_http_parser/RubyHttpParser.java:339
    receive_data at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/connection.rb:63
  event_callback at /home/dirk/.rvm/gems/jruby-1.7.2/gems/eventmachine-1.0.0-java/lib/eventmachine.rb:1479
   eventCallback at /home/dirk/.rvm/gems/jruby-1.7.2/gems/eventmachine-1.0.0-java/lib/jeventmachine.rb:92
     run_machine at /home/dirk/.rvm/gems/jruby-1.7.2/gems/eventmachine-1.0.0-java/lib/jeventmachine.rb:111
             run at /home/dirk/.rvm/gems/jruby-1.7.2/gems/eventmachine-1.0.0-java/lib/eventmachine.rb:187
       synchrony at /home/dirk/.rvm/gems/jruby-1.7.2/gems/em-synchrony-1.0.2/lib/em-synchrony.rb:28
           start at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/server.rb:73
      run_server at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/runner.rb:296
             run at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/runner.rb:221
            run! at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/application.rb:111
         Goliath at /home/dirk/RubymineProjects/ws1/goliath/lib/goliath/application.rb:129

Process finished with exit code 1

note1:
It runs fine with MRI ruby-1.9.3-p327.

Should be fixed as part of #228