# Crash if too many processes

**URL:** <https://www.ruby-forum.com/t/crash-if-too-many-processes/81734>\
**Category:** Rails\
**Created:** [January 12, 2007, 6:03am UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734 "2007-01-12T06:03:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 12, 2007, 6:03am UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/1 "2007-01-12T06:03:33Z")

</div>

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:in `load’”,  
“/usr/lib/ruby/1.8/pstore.rb:118:in `transaction'", "/usr/lib/ruby/1.8/cgi/session/pstore.rb:90:in `update’”,  
“/usr/lib/ruby/1.8/cgi/session/pstore.rb:97:in `close'", "/usr/lib/ruby/1.8/cgi/session.rb:330:in `close’”,  
“/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:in `process’”,  
“/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:in `dispatch’”,  
“/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:in `service’”, “/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'", "/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’”,  
“/usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'", "/usr/lib/ruby/1.8/webrick/server.rb:144:in `start’”,  
“/usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'", "/usr/lib/ruby/1.8/webrick/server.rb:94:in `start’”,  
“/usr/lib/ruby/1.8/webrick/server.rb:89:in `each'", "/usr/lib/ruby/1.8/webrick/server.rb:89:in `start’”,  
“/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'", "/usr/lib/ruby/1.8/webrick/server.rb:79:in `start’”,  
"/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/](http://127.0.0.1:3000/) → /recipe/new

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 13, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/2 "2007-01-13T17:00:19Z")

</div>

anybody?

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 14, 2007, 7:11am UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/3 "2007-01-14T07:11:52Z")

</div>

> 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”… 🙂 I guess I’ll stop being lazy…

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 13, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/4 "2007-01-13T17:38:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/5 "2007-01-19T16:31:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 19, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/6 "2007-01-19T16:29:16Z")

</div>

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

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

---

<div class="post-metadata">

**Author:** ![alon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@alon](https://www.ruby-forum.com/u/alon)\
**Post date:** [January 19, 2007, 5:54pm UTC](https://www.ruby-forum.com/t/crash-if-too-many-processes/81734/7 "2007-01-19T17:54:52Z")

</div>

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.
