JRuby

closed stream (IOError) from rspec spec_server script

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Incomplete
  • Affects Version/s: JRuby 1.1.6
  • Fix Version/s: None
  • Component/s: Application Error
  • Labels:
    None
  • Environment:
    Ubuntu Linux
  • Number of attachments :
    0

Description

Create an empty rails 2.2.2 project and a dummy controller test.

Next, start the rspec server with:

jruby script/spec_server

This appears to work fine:

Loading Rails environment
Ready

Open a new terminal and then:

jruby script/spec -X spec/controllers/test_controller_spec.rb

gives "closed stream (IOError)"

For full details, see:

http://www.nabble.com/spec_server-in-Rails-app--td17627372.html

Activity

Hide
Miika Leppänen added a comment -

I'm having the same issue:
$ jruby -S spec -X -o spec/spec.opts spec/controllers/companies_controller_spec.rb
(druby://127.0.0.1:8989) script/spec_server:14:in `run': closed stream (IOError)
from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1548:in `perform_without_block'
from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1508:in `perform'
from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1582:in `main_loop'
from (druby://127.0.0.1:8989) :1:in `accept'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/drb_command_line.rb:13:in `run'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/option_parser.rb:188:in `parse_drb'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/option_parser.rb:128:in `order!'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner.rb:59:in `options'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:4:in `run'
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:4
from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:19:in `load'
from /usr/local/jruby/bin/spec:19

Show
Miika Leppänen added a comment - I'm having the same issue: $ jruby -S spec -X -o spec/spec.opts spec/controllers/companies_controller_spec.rb (druby://127.0.0.1:8989) script/spec_server:14:in `run': closed stream (IOError) from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1548:in `perform_without_block' from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1508:in `perform' from (druby://127.0.0.1:8989) /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1582:in `main_loop' from (druby://127.0.0.1:8989) :1:in `accept' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/drb_command_line.rb:13:in `run' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/option_parser.rb:188:in `parse_drb' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner/option_parser.rb:128:in `order!' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/runner.rb:59:in `options' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:4:in `run' from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:4 from /usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/rspec-1.1.12/bin/spec:19:in `load' from /usr/local/jruby/bin/spec:19
Hide
Mike Grafton added a comment -

I am also seeing this problem. It is especially irksome given how long it takes JRuby to start up Rails - doing TDD is very painful when it takes 10 seconds just to get your spec going!

In this world, the rspec spec_server is a very helpful way to speed up your TDD cycles. Getting this working would be a big win for JRuby!

Show
Mike Grafton added a comment - I am also seeing this problem. It is especially irksome given how long it takes JRuby to start up Rails - doing TDD is very painful when it takes 10 seconds just to get your spec going! In this world, the rspec spec_server is a very helpful way to speed up your TDD cycles. Getting this working would be a big win for JRuby!
Hide
Ulrik Schønnemann added a comment -

This is an important issue for my team as well. We can not upgrade from Rails 2.1.0 due to the speed of running specs in higher versions...

Show
Ulrik Schønnemann added a comment - This is an important issue for my team as well. We can not upgrade from Rails 2.1.0 due to the speed of running specs in higher versions...
Hide
Matthew Churcher added a comment -

I'd suggest you have two issues here:

1.) RSpec in JRuby fails to catch Java Exceptions, hence the exception prints to the console rather then the RSpec output.
To work around this catch all Java exceptions thrown by your code and raise a ruby exception instead
e.g.

begin
myJavaClass.thowsException()
rescue MyJavaException => e
raise "My Custom Java Exception"
end

2.) JRuby is throwing an unhanded Java NullPointerException, which seems to trigger this "closed stream IOError" when attempting to wrap it to a ruby object.

Show
Matthew Churcher added a comment - I'd suggest you have two issues here: 1.) RSpec in JRuby fails to catch Java Exceptions, hence the exception prints to the console rather then the RSpec output. To work around this catch all Java exceptions thrown by your code and raise a ruby exception instead e.g. begin myJavaClass.thowsException() rescue MyJavaException => e raise "My Custom Java Exception" end 2.) JRuby is throwing an unhanded Java NullPointerException, which seems to trigger this "closed stream IOError" when attempting to wrap it to a ruby object.
Hide
Douglas Campos added a comment -

shouldn't we close this issue?

Show
Douglas Campos added a comment - shouldn't we close this issue?
Hide
Charles Oliver Nutter added a comment -

Seems like this one has probably healed over time, possibly due to JRuby 1.5 allowing "rescue Exception" to handle Java exceptions. If there's something more to do on this, reopen (or file new bugs for different issues).

Show
Charles Oliver Nutter added a comment - Seems like this one has probably healed over time, possibly due to JRuby 1.5 allowing "rescue Exception" to handle Java exceptions. If there's something more to do on this, reopen (or file new bugs for different issues).

People

Vote (5)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: