Crash if too many processes


#1

Hello,

I’m running my ROR app in dev mode on my local machine with webrick.

In preparation for production I am testing on 3 different browsers. They
all work well separately, however when they all talk to webrick
simulatniously one of them just gives up (usually the one that sends the
request the last). The way I reproduce this is just by clicking on
“refresh” on each one of them so they load the same page at once.

Below is what webrick shows. I don’t really understand what’s going on
but I’m guessing it’s related to loading the session files of the user
(?). Can’t access 3 session files at once? sounds strange. I’m using
Pstore for sessions. Just to make sure each browser is logged on under
a different user. but that didn’t change anything.

This worries me a little bit as I want to move to production soon. Is
this unusual with webrick on a local installation? or anybody seen this
before?

thanks a bunch!

browser shows:

Not Found
`/recipe/new’ not found.
WEBrick/1.3.1 (Ruby/1.8.2/2004-12-25) at 127.0.0.1:3000

webrick console:

#<ArgumentError: undefined class/module User>
["/usr/lib/ruby/1.8/pstore.rb:163:in load'", "/usr/lib/ruby/1.8/pstore.rb:163:inload’",
“/usr/lib/ruby/1.8/pstore.rb:118:in transaction'", "/usr/lib/ruby/1.8/cgi/session/pstore.rb:90:inupdate’”,
“/usr/lib/ruby/1.8/cgi/session/pstore.rb:97:in close'", "/usr/lib/ruby/1.8/cgi/session.rb:330:inclose’”,
“/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:811:in
close_session'", "/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:357:inprocess’”,
“/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:20:in
process_with_exception'", "/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:34:indispatch’”,
“/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in
handle_dispatch'", "/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:inservice’”, “/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service'", "/usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’”,
“/usr/lib/ruby/1.8/webrick/server.rb:155:in start_thread'", "/usr/lib/ruby/1.8/webrick/server.rb:144:instart’”,
“/usr/lib/ruby/1.8/webrick/server.rb:144:in start_thread'", "/usr/lib/ruby/1.8/webrick/server.rb:94:instart’”,
“/usr/lib/ruby/1.8/webrick/server.rb:89:in each'", "/usr/lib/ruby/1.8/webrick/server.rb:89:instart’”,
“/usr/lib/ruby/1.8/webrick/server.rb:79:in start'", "/usr/lib/ruby/1.8/webrick/server.rb:79:instart’”,
"/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in
dispatch'", "script/server:49"] [2007-01-11 23:52:53] ERROR/recipe/new’ not found.
127.0.0.1 - - [11/Jan/2007:23:52:41 EST] “GET /recipe/new HTTP/1.1” 404
280
http://127.0.0.1:3000/ -> /recipe/new


#2

anybody?


#3

Well to rule out webrick install lighttpd.
Rails will use that.
Or even simpler install mongrel.
See if you have the same problems

thanks Peter. that’s a good option. I was hoping however to hear from
somebody “yeah, that’s a common problem with webrick on a local
installation”… :slight_smile: I guess I’ll stop being lazy…


#4

Well to rule out webrick install lighttpd.
Rails will use that.
Or even simpler install mongrel.
See if you have the same problems


#5

try running:
$ script/server production

I believe this puts webrick into production mode, and prevent caching of
classes. I’m wondering if something in dev mode is causing conflict.

Do you have a production server that you can sandbox and test there?

What are the logs/development.log saying?

Matt


#6

Actually if you are being close to rolling out the application to
production, you should be testing against your production setup:
Apache, FastCGI, Mongrel, mod_proxy, whatever. Things like caching can
be dependent of your setup.


Aníbal
http://www.rubycorner.com
http://www.hasmanydevelopers.com


#7

matt wrote:

try running:
$ script/server production

I believe this puts webrick into production mode, and prevent caching of
classes. I’m wondering if something in dev mode is causing conflict.

Do you have a production server that you can sandbox and test there?

What are the logs/development.log saying?

Matt

Thanks guys! this was very helpful. In dev mode the problem is easily
reproduced while in production mode (still in webrick) I couldn’t
reproduce it after repeatedly trying. bingo.
I suppose that what is happening is that this error: #<ArgumentError:
undefined class/module User> is caused in dev mode because many
different threads are trying to reload the same class, and therefore the
last one times out… well that would be my best guess at least.

anyway, this is encouraging.
thanks for the pointers.

Alon.