Dispatch Error

I am suddenly having a strange error. Whenever I try to do anything in my rails application when it's running on WEBrick it just dies with an ArgumentError 0 for 1 while in Mongrel it doesn't die but every redirect_to generates a static page saying "you are being redirected" it never actually redirects from this page though.

I've tried re-installing mongrel, activerecord and rails but that doesn't seem to be helping.

Please post the full backtrace generated by webrick and we may be able to guide you a little better. Most likely it's a simple problem. In your debugging you will probably never have to reinstall any of those things (not set in stone of course, I'm sure some people have to but it's a rarity. I've certainly never reinstalled them).

-Chuck Vose

Here is the Mongrel backtrace:

Mon Jul 30 09:05:16 -0600 2007: Error calling Dispatcher.dispatch #<ArgumentError: wrong number of arguments (0 for 1)> C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `hash' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:2159:in `inject' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `inject' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:280:in `reset_subclasses' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:58:in `reset_application!' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:116:in `reset_after_dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:51:in `dispatch' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:78:in `process' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:76:in `synchronize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:76:in `process' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 618:in `process_client' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 617:in `each' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 617:in `process_client' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `initialize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `new' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `initialize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `new' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:271:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:270:in `each' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:270:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails: 127:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ command.rb:211:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails: 243 C:\ruby\bin\mongrel_rails:16:in `load' C:\ruby\bin\mongrel_rails:16 -e:3:in `load' -e:3

And here is the WEBrick backtrace:

#<ArgumentError: wrong number of arguments (0 for 1)> ["C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `hash'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1315:in `'", "C:/ruby/ lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb: 1315:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ base.rb:518:in `inject'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `each'", "C:/ ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `inject'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:280:in `reset_subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/ rails-1.2.3/lib/dispatcher.rb:58:in `reset_application!'", "C:/ruby/ lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:116:in `reset_after_dispatch'", "C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/ lib/dispatcher.rb:51:in `dispatch'", "C:/ruby/lib/ruby/gems/1.8/gems/ rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'", "C:/ruby/ lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'", "C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'", "C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'", "C:/ ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'", "C:/ruby/lib/ruby/ 1.8/webrick/server.rb:162:in `start_thread'", "C:/ruby/lib/ruby/1.8/ webrick/server.rb:95:in `start'", "C:/ruby/lib/ruby/1.8/webrick/ server.rb:92:in `each'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'", "C:/ ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'", "C:/ruby/lib/ruby/ gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'", "C:/ ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/comma[2007-07-30 09:17:07] ERROR `/users/new' not found. 127.0.0.1 - - [30/Jul/2007:09:17:06 Mountain Daylight Time] "GET / users/new HTTP/1.1" 404 279 - -> /users/new nds/servers/webrick.rb:59", "C:/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'", "C:/ruby/lib/ruby/ site_ruby/1.8/rubygems/custom_require.rb:27:in `require'", "C:/ruby/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'", "C:/ruby/lib/ruby/gems/1.8/gems/ activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'", "C:/ruby/lib/ruby/gems/1.8/gems/ activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'", "C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/ server.rb:39", "C:/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'", "C:/ruby/lib/ruby/ site_ruby/1.8/rubygems/custom_require.rb:27:in `require'", "./script/ server:3", "-e:4:in `load'", "-e:4"]

Basically I'm getting a 404 for any "page" when running WEBrick. Mongrel serves the pages but chokes on any redirect_to statement. Mongrel gives the error listed above for any and all requests but renders the pages and handles data properly.

Alright, I'll admit that I don't know what it is off the top of my head. I'm sure it's user error because google isn't brimming with answers to your question, but I'm not sure what kind of user error.

What I would suggest is to go out and get a copy of the ruby-debug gem, include it in development.rb, and toss debugger in your environment file somewhere. Step through your program and find out where this mess is starting. (try `set autolist` then type `n` enter once and then enter again and again until you see problems).

This has helped me time and time again when I just have no clue about an error, hopefully it'll help you too.

The other option at hand is to diff with the latest revision if you're using subversion and see what all you've changed. Also helpful and sometimes much faster but not everyone is using version control. Also not very helpful if you commit big changesets.

Hope that helps, you've got an interesting problem for sure. Chuck Vose

DBM -

Alright, I'll admit that I don't know what it is off the top of my head. I'm sure it's user error because google isn't brimming with answers to your question, but I'm not sure what kind of user error.

What I would suggest is to go out and get a copy of the ruby-debug gem, include it in development.rb, and toss debugger in your environment file somewhere. Step through your program and find out where this mess is starting. (try `set autolist` then type `n` enter once and then enter again and again until you see problems).

This has helped me time and time again when I just have no clue about an error, hopefully it'll help you too.

The other option at hand is to diff with the latest revision if you're using subversion and see what all you've changed. Also helpful and sometimes much faster but not everyone is using version control. Also not very helpful if you commit big changesets.

Hope that helps, you've got an interesting problem for sure. Chuck Vose

Here is the Mongrel backtrace:

Mon Jul 30 09:05:16 -0600 2007: Error calling Dispatcher.dispatch #<ArgumentError: wrong number of arguments (0 for 1)> C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `hash' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:2159:in `inject' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `inject' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `subclasses' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:280:in `reset_subclasses' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:58:in `reset_application!' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:116:in `reset_after_dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:51:in `dispatch' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:78:in `process' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:76:in `synchronize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ rails.rb:76:in `process' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 618:in `process_client' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 617:in `each' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 617:in `process_client' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `initialize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `new' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 736:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `initialize' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `new' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel.rb: 720:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:271:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:270:in `each' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ configurator.rb:270:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails: 127:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/ command.rb:211:in `run' C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails: 243 C:\ruby\bin\mongrel_rails:16:in `load' C:\ruby\bin\mongrel_rails:16 -e:3:in `load' -e:3

And here is the WEBrick backtrace:

#<ArgumentError: wrong number of arguments (0 for 1)> ["C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1315:in `hash'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1315:in `'", "C:/ruby/ lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb: 1315:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ base.rb:518:in `inject'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `each'", "C:/ ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1316:in `inject'", "C:/ruby/lib/ruby/gems/1.8/gems/ activerecord-1.15.3/lib/active_record/base.rb:1316:in `subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:280:in `reset_subclasses'", "C:/ruby/lib/ruby/gems/1.8/gems/ rails-1.2.3/lib/dispatcher.rb:58:in `reset_application!'", "C:/ruby/ lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:116:in `reset_after_dispatch'", "C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/ lib/dispatcher.rb:51:in `dispatch'", "C:/ruby/lib/ruby/gems/1.8/gems/ rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'", "C:/ruby/ lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'", "C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'", "C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'", "C:/ ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'", "C:/ruby/lib/ruby/ 1.8/webrick/server.rb:162:in `start_thread'", "C:/ruby/lib/ruby/1.8/ webrick/server.rb:95:in `start'", "C:/ruby/lib/ruby/1.8/webrick/ server.rb:92:in `each'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'", "C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'", "C:/ ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'", "C:/ruby/lib/ruby/ gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'", "C:/ ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/comma[2007-07-30 09:17:07] ERROR `/users/new' not found. 127.0.0.1 - - [30/Jul/2007:09:17:06 Mountain Daylight Time] "GET / users/new HTTP/1.1" 404 279 - -> /users/new nds/servers/webrick.rb:59", "C:/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'", "C:/ruby/lib/ruby/ site_ruby/1.8/rubygems/custom_require.rb:27:in `require'", "C:/ruby/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'", "C:/ruby/lib/ruby/gems/1.8/gems/ activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'", "C:/ruby/lib/ruby/gems/1.8/gems/ activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'", "C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/ server.rb:39", "C:/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'", "C:/ruby/lib/ruby/ site_ruby/1.8/rubygems/custom_require.rb:27:in `require'", "./script/ server:3", "-e:4:in `load'", "-e:4"]

Basically I'm getting a 404 for any "page" when running WEBrick. Mongrel serves the pages but chokes on any redirect_to statement. Mongrel gives the error listed above for any and all requests but renders the pages and handles data properly.

Please post the full backtrace generated by webrick and we may be able to guide you a little better. Most likely it's a simple problem. In your debugging you will probably never have to reinstall any of those things (not set in stone of course, I'm sure some people have to but it's a rarity. I've certainly never reinstalled them).

-Chuck Vose

I am suddenly having a strange error. Whenever I try to do anything in my rails application when it's running on WEBrick it just dies with an ArgumentError 0 for 1 while in Mongrel it doesn't die but every redirect_to generates a static page saying "you are being redirected" it never actually redirects from this page though.

I've tried re-installing mongrel, activerecord and rails but that doesn't seem to be helping.

In addition to Chuck's advice, I would first try to consider recent changes.

When did this symptom appear. Can you revert to an earlier version. Then slowly add back changes.

I've got a feeling it might be environment related - new plugin? environment.rb change? routing change?

good luck. One's can be painful.

Jodi

Thanks, I'll give that a try.

It would seem that whatever I've done has broken entirely different applications that worked that last time they were touched too.

Okay the last thing it tries to do before throwing the error is reset_after_dispatch

I don't have any plugins currently installed for this application. I have acts_as_attachment installed in another application however that shouldn't bleed over shout it?

I haven't changed much of the default setup for this one yet (it's pretty simple). I did uncomment the # map.connect ':controller/ service.wsdl', :action => 'wsdl' line in routes. I tried commenting it out again but that didn't help any.

Like Chuck says it must be my app but I have no idea what I could have done to cause this. I just tried running it on a clean install of everything on a different machine and it is behaving the same way which should permanently put to rest the slightest doubt that it is my code that is doing it.

Okay after stepping back, for lunch and other work, I have a good idea of the general cause. I just have to figure out what part of the suspect code is causing the problem.

Thanks for your help guys.

It would appear that the source of the problem was somewhere in the code for recipes 15.8 and 15.9 in the Ruby Cookbook. I wasn't able to figure out what was causing the problem so I ripped the whole thing out and used a different resource.

That's what I get for being lazy and copying verbatim from a book.

It looks like I'm getting the same error. After upgrading to rails 1.2.3, I get the same dispatch error:

Wed Aug 01 22:44:37 -0700 2007: Error calling Dispatcher.dispatch #<NameError: cannot remove Object::VERBOTEN_TAGS>

I began experiencing this same problem when I updated my app to Rails 1.2.3 and mongrel 1.0.1 on 2 Aug, a google search brought me straight to this post.