# Mongrel service keeps re-starting ruby

**URL:** <https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005>\
**Category:** Mongrel\
**Created:** [June 25, 2009, 7:35am UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005 "2009-06-25T07:35:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 7:35am UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/1 "2009-06-25T07:35:05Z")

</div>

Hi all,

Some disclaimer first: I am a complete newbie in mongrel and this list,  
so please forgive me if I say something weird. I have a problem, I’ve  
googled for a solution for quite a while and failed so far, so decided  
to ask here.

I am trying to set up my Rails application on Windows according to this  
manual:  
[http://nlakkakula.wordpress.com/2008/11/24/10-steps-for-deploying-your-ruby-on-rails-application-on-a-windows-server-2008-apache-mongrel-cluster/](http://nlakkakula.wordpress.com/2008/11/24/10-steps-for-deploying-your-ruby-on-rails-application-on-a-windows-server-2008-apache-mongrel-cluster/)  
. Everything is ok however when I completed all the steps, Apache  
complains that it cannot contact proxy - meaning there is something  
wrong with mongrel. I digged further and found mongrel keeping  
re-starting the ruby process. If I look into a task manager, the picture  
is like:

- 

```
     A ruby.exe process is started

```

- 

```
     It eats 100% CPU for 5 seconds

```

- 

```
     It also eats about 25MB RAM

```

- 

```
     It dies then

```

And the process repeats forever. It looks like there is some error  
happening but I don’t know any way to capture it.

My OS is Win2k Advanced Server SP4. Any ideas?

Thanks,  
Mike Pliskin

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 2:26pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/2 "2009-06-25T14:26:07Z")

</div>

On Thu, Jun 25, 2009 at 2:07 AM, Michael Pliskin[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I am trying to set up my Rails application on Windows according to this
> 
> Thanks,
> 
> Mike Pliskin

That behavior is normal with mongrel\_service. has been implemented in  
a way that the ruby process automatically restart in case of a  
failure, which is seems is happening in the background.

To debug this, please start mongrel standalone:

cd my\_app  
mongrel\_rails start

Doing that, you should see, on the console, what is happening.

Please paste the results on your reply so I can help you out.

## Cheers,

## Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupéry

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 2:56pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/3 "2009-06-25T14:56:03Z")

</div>

Dear Luis,

Thanks a lot for replying, I followed your advice and it revealed the  
problem: it was the --prefix switch that caused it. When I start it like  
E:\RailsApps\3vi\>mongrel\_rails start -e development -p 3001 -a 127.0.0.1  
-l “e:/RailsApps/3vi/log/1.log” -P “e:/RailsApps/3vi/log/mongrel.pid” -t  
0 -r “public” -n 1024 --prefix “/labelyzer”  
I am given a ton of errors:  
\*\* Starting Mongrel listening at 127.0.0.1:3001  
\*\* Starting Rails with development environment…  
\*\* Mounting Rails at /labelyzer…  
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active\_support/dependencies.rb:440:in  
`load_missing_constant': uninitialized constant ActionController::AbstractRequest (NameError) from D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in`const\_missing’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/…/lib/mongrel/rails.rb:151:in  
`rails' from D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel_rails:113:in`cloaker\_’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/…/lib/mongrel/configurator.rb:149:in  
`call' from D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../lib/mongrel/configurator.rb:149:in`listener’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel\_rails:99:in  
`cloaker_' from D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../lib/mongrel/configurator.rb:50:in`call’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/…/lib/mongrel/configurator.rb:50:in  
`initialize' from D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel_rails:84:in`new’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel\_rails:84:in  
`run' from D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../lib/mongrel/command.rb:212:in`run’  
from  
D:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel\_rails:281  
from D:/Ruby/bin/mongrel\_rails:19:in `load’  
from D:/Ruby/bin/mongrel\_rails:19

And if I skip --prefix, it’s all fine. Any ideas?

Thanks in advance,  
Mike

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/4 "2009-06-25T16:11:46Z")

</div>

Are you using Rails 2.2?

The latest version of mongrel available by gem is broken with --prefix  
and Rails 2.2. I’d still expect it to simply report an error instead of  
consuming all CPU, so that’s odd (but I’ve never developed Rails on  
Windows before either).

But if you are using Rails 2.2 that could still be it, since I too have  
discovered that you can’t use --prefix with a Rails 2.2 app, without  
either patching mongrel or patching your rails app. (I find patching the  
Rails app to be easier and less scary, and can tell you how I’ve done it  
if this is indeed your issue).

I do think it’s a big odd that Rails 2.2 has been out for so long, but  
mongrel hasn’t released a gem that’s compatible with it, or warned  
people on the project page that there’s a problem, or what have you.  
Makes me kind of worried that there aren’t very many (any?) people on  
the mongrel development team, and one shouldn’t count on future  
versions.

Jonathan

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 4:15pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/5 "2009-06-25T16:15:19Z")

</div>

Ah, actually reading your stack trace, I see it is indeed the --prefix  
and modern versions of Rails issue. I still don’t know why that  
consumes all CPU instead of just reporting an error.

But mongrel is trying to call a method that no longer exists in RAils  
2.3 like you have. (I think it dissappeared in Rails 2.2, but could be  
wrong, it’s definitely gone in Rails 2.3).

Try dropping this file in your app’s config/initializers directory, to  
basically restore the method that mongrel is trying to call, as a  
wrapper for the new way to trigger this functionality.

config/initializers/patch\_for\_mongrel.rb [name of file can be anything]

# Fix for mongrel which still doesn’t know about Rails 2.2’s changes,

grr.

# We provide a backwards compatible wrapper around the new

ActionController::base.relative\_url\_root,

# so it can still be called off of the actually non-existing

AbstractRequest class.

module ActionController  
class AbstractRequest \< ActionController::Request  
def self.relative\_url\_root=(path)  
ActionController::Base.relative\_url\_root=(path)  
end  
def self.relative\_url\_root  
ActionController::Base.relative\_url\_root  
end  
end  
end

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 26, 2009, 11:51am UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/6 "2009-06-26T11:51:35Z")

</div>

Hi Jonathan,

Thanks a million, your fix worked like a charm! Everything is ok now.  
Thanks again for fast and superb response!

Mike

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [August 18, 2009, 9:18pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/7 "2009-08-18T21:18:02Z")

</div>

It sure helped me.

Thanks,  
Tiberiu

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [June 25, 2009, 4:30pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/8 "2009-06-25T16:30:34Z")

</div>

On Thu, Jun 25, 2009 at 11:04 AM, Jonathan R.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Are you using Rails 2.2?  
> The latest version of mongrel available by gem is broken with --prefix and  
> Rails 2.2. I’d still expect it to simply report an error instead of  
> consuming all CPU, so that’s odd (but I’ve never developed Rails on Windows  
> before either).

Is consuming the CPU since mongrel\_service is trying to restart the  
ruby process once it failed.

Mea culpa,ruby 1.8.5 used to segfault from time to time and I’ve  
implemented that automatic restart at that time to workaround it.

Since ruby is raising an error and exiting, mongrel\_service is trying  
to restart it 😛

> team, and one shouldn’t count on future versions.

I’m here, but basically being focused on updated One-Click Ruby  
Installer project, which will make life more easy at least for me on  
Windows 😉

## I think there is time for a 1.1.6 release with fixes for this and other details.

## Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupéry

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 12:24pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/9 "2010-12-13T12:24:40Z")

</div>

Hi All,

I have exactly the same problem : mongrel keeps restarting the ruby  
process.  
I have installed the patch\_for\_mongrel.rb proposed by Jonathan. I have  
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]  
My version of Gem is 1.3.7. Here is the result of my command :

U:\>mongrel\_rails start -e production -p 3001 -a 10.0.5.201 -l  
“mongrel.log” -P “mongrel.pid” -c “D:/wamp/www/redmine” -t 0 -r “public”  
-n 1024  
\*\* Starting Mongrel listening at 10.0.5.201:3001  
\*\* Starting Rails with production environment…  
D:/wamp/www/redmine/config/…/vendor/rails/railties/lib/rails/gem\_dependency.rb:119:Warning:  
Gem::Dependency#version\_requirements is deprecated and will be remo  
ved on or after August 2010. Use #requirement  
d:/Ruby187/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 74, col 21:` authentication: : login’ (ArgumentError)  
from d:/Ruby187/lib/ruby/1.8/yaml.rb:133:in `load' from d:/Ruby187/lib/ruby/1.8/yaml.rb:144:in`load\_file’  
from d:/Ruby187/lib/ruby/1.8/yaml.rb:143:in `open' from d:/Ruby187/lib/ruby/1.8/yaml.rb:143:in`load\_file’  
from D:/wamp/www/redmine/config/initializers/40-email.rb:6  
from  
D:/wamp/www/redmine/vendor/rails/activesupport/lib/active\_support/dependencies.rb:147:in  
`load_without_new_constant_marking' from D:/wamp/www/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in`load’  
from  
D:/wamp/www/redmine/config/…/vendor/rails/railties/lib/initializer.rb:622:in  
`load_application_initializers' from D:/wamp/www/redmine/config/../vendor/rails/railties/lib/initializer.rb:621:in`each’  
from  
D:/wamp/www/redmine/config/…/vendor/rails/railties/lib/initializer.rb:621:in  
`load_application_initializers' from D:/wamp/www/redmine/config/../vendor/rails/railties/lib/initializer.rb:176:in`process’  
from  
D:/wamp/www/redmine/config/…/vendor/rails/railties/lib/initializer.rb:113:in  
`send' from D:/wamp/www/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in`run’  
from D:/wamp/www/redmine/config/environment.rb:20  
from  
d:/Ruby187/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' from d:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/…/lib/mongrel/rails.rb:147:in  
`rails' from d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:113:in`cloaker\_’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/…/lib/mongrel/configurator.rb:149:in  
`call' from d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/../lib/mongrel/configurator.rb:149:in`listener’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel\_rails:99:in  
`cloaker_' from d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/../lib/mongrel/configurator.rb:50:in`call’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/…/lib/mongrel/configurator.rb:50:in  
`initialize' from d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:84:in`new’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel\_rails:84:in  
`run' from d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/../lib/mongrel/command.rb:212:in`run’  
from  
d:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel\_rails:281  
from d:/Ruby187/bin/mongrel\_rails:19:in `load’  
from d:/Ruby187/bin/mongrel\_rails:19

Any Idea ?

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 2:20pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/10 "2010-12-13T14:20:10Z")

</div>

I have checked the .yml file. See attached to my post. The error refers  
to a comment line. Nothing before the line 74 looks wrong. No tabulation  
reached.  
I have moved the yml file and install again ruby with the installer.exe.  
The old yml file and the new one matches, no différence found. Pretty  
strange …

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 1:59pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/11 "2010-12-13T13:59:29Z")

</div>

On Mon, Dec 13, 2010 at 8:24 AM, Sebastien P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> -n 1024

Yes, please read the exception: “syntax error on line 74, …” that is  
reading a YAML file, check there is no tab or incorrect indentation in  
that file.

## – Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupry

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 2:53pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/12 "2010-12-13T14:53:37Z")

</div>

On Mon, Dec 13, 2010 at 10:20 AM, Sebastien P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have checked the .yml file. See attached to my post. The error refers  
> to a comment line. Nothing before the line 74 looks wrong. No tabulation  
> reached.

You attached the ruby file from YAML, but if you look at the reference  
in the output:

`load': syntax error on line 74, col 21: ` authentication: : login’

You have a YAML file that contains a “: login” that is not a symbol.  
There should not be spaces for symbols.

Please check your yaml files, not the YAML parser.

> I have moved the yml file and install again ruby with the installer.exe.  
> The old yml file and the new one matches, no diffrence found. Pretty  
> strange …

## This has nothing to do with the YAML parser or Ruby, is one of your configuration files.

## Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupry

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 3:50pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/13 "2010-12-13T15:50:07Z")

</div>

On Mon, Dec 13, 2010 at 10:30 AM, Sebastien P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sorry, I have found many tabulation in this file replaced them with  
> space caracter but the problem remained.

Can you pastie the file that contains the authentication line I  
mentioned before? There must be a syntax error there you’re not  
seeing.

## – Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupry

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 2:30pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/14 "2010-12-13T14:30:48Z")

</div>

Sorry, I have found many tabulation in this file replaced them with  
space caracter but the problem remained.

---

<div class="post-metadata">

**Author:** ![Michael\_Pliskin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@Michael\_Pliskin](https://www.ruby-forum.com/u/Michael_Pliskin)\
**Post date:** [December 13, 2010, 5:33pm UTC](https://www.ruby-forum.com/t/mongrel-service-keeps-re-starting-ruby/171005/15 "2010-12-13T17:33:16Z")

</div>

You solved my problem ! It was amazing for a php devlopper like me to  
see the starting ruby service was parsing a yml file I edited one week  
ago in the redmine application whereas redmine was still working fine  
yesterday. Anyway thanks a lot for your help Luis, I would not think  
about searching in my redmine directory the solution. regards.
