History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1503
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Blocker Blocker
Assignee: Charles Oliver Nutter
Reporter: Evan Weaver
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JRuby

disabled objectspace causes failures in Net/HTTP

Created: 01/Nov/07 01:22 AM   Updated: 23/Apr/08 10:03 AM
Component/s: None
Affects Version/s: None
Fix Version/s: JRuby 1.1RC1

Time Tracking:
Not Specified


 Description  « Hide
The default disabled objectspace is making something in Net/HTTP blow
up. You can reproduce it by running the jruby mongrel 1.1 tests.

chloe:~/p/mongrel/trunk eweaver$ jruby +O test/test_configurator.rb
--name test_base_handler_config
Loaded suite test/test_configurator
Started
.
Finished in 1.395 seconds.

1 tests, 8 assertions, 0 failures, 0 errors
chloe:~/p/mongrel/trunk eweaver$ jruby -O test/test_configurator.rb
--name test_base_handler_config
Loaded suite test/test_configurator
Started
E
Finished in 0.31 seconds.

1) Error:
test_base_handler_config(ConfiguratorTest):
EOFError: End of file reached
/opt/local/jruby/lib/ruby/1.8/net/protocol.rb:132:in `timeout'
/opt/local/jruby/lib/ruby/1.8/timeout.rb:52:in `timeout'
/opt/local/jruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/opt/local/jruby/lib/ruby/1.8/net/protocol.rb:132:in `readuntil'
/opt/local/jruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:1047:in `read_status_line'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:1047:in `read_new'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:1047:in `request'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:945:in `request_get'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:380:in `get_response'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:452:in `start'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:452:in `get_response'
/opt/local/jruby/lib/ruby/1.8/net/http.rb:452:in `get'
./test/testhelp.rb:40:in `test_base_handler_config'
test/test_configurator.rb:71:in `test_base_handler_config'

1 tests, 5 assertions, 0 failures, 1 errors



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 07/Nov/07 12:30 AM
We need to understand why this happens and fix or wontfix for 1.1. But at the very least we need to know what's happening.

Peter Brant - 11/Nov/07 06:31 PM
It looks like this doesn't have anything to do with Net/HTTP. It's caused by the code below in lib/mongrel/debug.rb. With ObjectSpace disabled, each_object raises an exception that is never caught. The thread dies, the socket is closed, and the client complains. If I wrap the ObjectSpace.each_object call with a begin/rescue, the test works.
  class Threads < GemPlugin::Plugin "/handlers"
    include Mongrel::HttpHandlerPlugin

    def process(request, response)
      MongrelDbg::trace(:threads, "#{Time.now} REQUEST #{request.params['PATH_INFO']}")
      ObjectSpace.each_object do |obj|
        begin
          if obj.class == Mongrel::HttpServer
            worker_list = obj.workers.list

            if worker_list.length > 0
              keys = "-----\n\tKEYS:"
              worker_list.each {|t| keys << "\n\t\t-- #{t}: #{t.keys.inspect}" }
            end

            MongrelDbg::trace(:threads, "#{obj.host}:#{obj.port} -- THREADS: #{worker_list.length} #{keys}")
          end
        rescue Object
          # ignore since obj.class can sometimes take parameters
        end
      end
    end
  end

Evan Weaver - 11/Nov/07 06:34 PM
Ah sneaky. The mongrel tests shouldn't be running in Debug mode anyway.

Charles Oliver Nutter - 16/Nov/07 02:53 PM
Evan: is it possible to alter this test to not use each_object? Or perhaps have the rescue report something (anything) so people will understand why it fails?

Let us know how you want to handle this.


Evan Weaver - 16/Nov/07 05:44 PM
I already have it silently ignore missing each_object. You can resolve the ticket how you wish.

Charles Oliver Nutter - 20/Dec/07 12:34 PM
Turned out the failures were related to each_object, but did not affect net/http in any real way. So we'll say "wontfix" for now, and mongrel has already updated to not use each_object.