Ruby Forum Mongrel > Mongrel Crashes in Production

Posted by James George (jameschacks)
on 18.03.2008 12:47
I have been getting this error on the production server after rails was
updated to 2.0.2 and moreover this worked perfectly in the development
mode. This crash occurs when no one is using the app for an hour or so.
This is the error that I get in the logs. (nohup.out file). The
production log doesnt show anything unusual. Please help me out guys.
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:98:in
`reload!': undefined method `reset_application!' for
ActionController::Dispatcher:Class (NoMethodError)
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:95:in
`synchronize'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:95:in
`reload!'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:165:in
`reload!'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:178:in
`setup_rails_signals'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/configurator.rb:303:in
`call'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/configurator.rb:303:in
`join'
       from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel


Thanks in advance.
Posted by Luis Lavena (luislavena)
on 18.03.2008 15:48
(Received via mailing list)
On Tue, Mar 18, 2008 at 8:47 AM, James George <lists@ruby-forum.com> 
wrote:
> I have been getting this error on the production server after rails was
>  updated to 2.0.2 and moreover this worked perfectly in the development
>  mode. This crash occurs when no one is using the app for an hour or so.
>  This is the error that I get in the logs. (nohup.out file). The
>  production log doesnt show anything unusual. Please help me out guys.
>   /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:98:in
>  `reload!': undefined method `reset_application!' for
>  ActionController::Dispatcher:Class (NoMethodError)
>        from

It seems you're getting a restart/reload signal to the mongrel
process, and it is trying to reload the Rails environment calling the
reset_application! method of ActionController::Dispatcher

There is no ActionController::Dispatcher, but there is a Dispatcher in
the global namespace (::Dispatcher)?

I cannot test it since Windows don't generate the HUP signal required
for this, but I think I'm in the good path.

HTH,
--
Luis Lavena
Multimedia systems
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams
Posted by Till Mossakowski (tillmo)
on 21.05.2008 14:41
The problem is that the method reset_application! is no longer available 
in rails 2.0, but Mongrel 1.1.4 is still using it in 
lib/mongrel/rails.rb.

I think you should be able to fix this problem by commenting out the 
line

trap("HUP") { log "HUP signal received."; reload!          }

in /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb.

Till
Posted by Zed A. Shaw (Guest)
on 21.05.2008 16:06
(Received via mailing list)
On Wed, 21 May 2008 14:41:40 +0200
Till Mossakowski <lists@ruby-forum.com> wrote:

> The problem is that the method reset_application! is no longer available 
> in rails 2.0, but Mongrel 1.1.4 is still using it in 
> lib/mongrel/rails.rb.

Do we know if that needs a fix?

--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
Posted by Till Mossakowski (tillmo)
on 21.05.2008 16:14
>> The problem is that the method reset_application! is no longer available 
>> in rails 2.0, but Mongrel 1.1.4 is still using it in 
>> lib/mongrel/rails.rb.
> 
> Do we know if that needs a fix?

Surely it needs. My fix only is a hack. Probably reset_application 
should be replaced with reload_application, but I am not sure.

Till
Posted by Till Mossakowski (tillmo)
on 23.05.2008 13:37
I have tested out my fix and strangely, it did not work. I have now 
commented out the line containing reset_application! in 
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb.

Till
Posted by Evan Weaver (eweaver)
on 23.05.2008 19:12
(Received via mailing list)
This line is for the reload signal that always says "Might not work
well" at startup, right? Did it used to work well? If nobody really
uses it might be better to remove it; otherwise, we should try to get
it to work well (which can be hellish with Rails' dependency system).

Evan
Posted by Zed A. Shaw (Guest)
on 23.05.2008 19:23
(Received via mailing list)
On Fri, 23 May 2008 13:03:58 -0400
"Evan Weaver" <evan@cloudbur.st> wrote:

> This line is for the reload signal that always says "Might not work
> well" at startup, right? Did it used to work well? If nobody really
> uses it might be better to remove it; otherwise, we should try to get
> it to work well (which can be hellish with Rails' dependency system).

It used to work OK, but it relies on the internal Rails reload
mechanism used for development mode.  It was intended to let you run
your rails app in production and then hit it to kick it over rather
than wait for a reload.

I'd say these days it's not needed and it risks running into changes in
how Rails operates.  Probably worth dropping.

--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
Posted by Evan Weaver (eweaver)
on 23.05.2008 19:42
(Received via mailing list)
Ok, good. That reload mechanism won't work with most people's
Capistrano deploys anyway because the new app code is in a different
working directory.

I'll make a ticket to remove it for 1.2.

Evan
Posted by Till Mossakowski (tillmo)
on 24.05.2008 07:38
> It used to work OK, but it relies on the internal Rails reload
> mechanism used for development mode.  It was intended to let you run
> your rails app in production and then hit it to kick it over rather
> than wait for a reload.

"It used to work OK" must refer to rails 1.2, since in rails 2.0, the 
method reset_application! is simply not available, and therefore the 
reload NEVER works with rails 2.0.