[Mongrel] Mongrel service will not start on win32 w/ --prefix option

Guy Ridout ridoutspam at gmail.com
Tue Feb 6 00:22:04 EST 2007


All, I am in need of some help. I've run into a problem that I am not able
to fix or even troubleshoot.  I am trying to run Mongrel as a service on
Win32.

Basically, my problem is that running Mongrel as a service works fine. Fine
until I change the configuration (using service::remove and
service::install) to use --prefix. I must have this as I am running multiple
webapps and app servers all behind apache.


So, here is the config that works. It does not use the --prefix option:
#1 (works)
  mongrel_rails service::install -N mongrel_app_service -c
c:\projects\rails-prod\myapp -p 4001 -e production

  (The service "path to executable" displayed under properties:)
  "c:/ruby/bin/mongrel_service.exe" single -e production -p 4001 -a
0.0.0.0-l "log/mongrel.log" -P "log/mongrel.pid" -c
"c:/projects/rails-prod/myapp"
-t 0 -r "public" -n 1024



Here is the config that is not working It *does* use the --prefix option.
That is the only difference:
#2 (does not work)
  mongrel_rails service::install -N mongrel_app_service -c
c:\projects\rails-prod\myapp -p 4001 -e production --prefix /myapproot

  (The service "path to executable" displayed under properties:)
  "c:/ruby/bin/mongrel_service.exe" single -e production -p 4001 -a
0.0.0.0-l "log/mongrel.log" -P "log/mongrel .pid" -c
"c:/projects/rails-prod/myapp"
-t 0 -r "public" -n 1024 --prefix "/myapproot"



The working version (#1) starts normally and serves requests as expected.
When I start the --prefix version of the service (#2), Windows displays a
dialog with the following:

  "The mongrel_app_service service on Local Computer started and then
stopped. Some services stop automatically if they have no work to do, for
example, the Performance Logs and Alerts service."

I have researched this error and found vague references (
http://rubyforge.org/pipermail/mongrel-users/2006-December/002513.html) that
running the service as another user, or clearing the "app logs" may resolve
this. I have not had any luck. I tried creating a dedicated user account,
but I get the same error. I am not sure what logs I would clear, but I tried
my rails/mongrel logs with no luck.

My biggest lead is the mongrel_service.log file which I think hints at the
root issue. I have captured the logging from a start of both the working
service config (#1) and the non-working config (#2). They are listed below
intact (all of #1, then all of #2), and then interleaved for easier
comparison (up until they diverge):


*** Good start (no prefix) ***native/mongrel_service.bas:120,
mongrel_service.single_onstop:
(#1)  # Logfile created on 05/02/2007 23:37:42
(#1)  native/mongrel_service.bas:148, mongrel_service.application:
(#1)    ServiceHost RunAsService
(#1)  native/mongrel_service.bas:54, mongrel_service.single_oninit:
(#1)    single_onInit()
(#1)  native/mongrel_service.bas:71, mongrel_service.single_oninit:
(#1)    starting child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024
(#1)  # Logfile created on 05/02/2007 23:37:42
(#1)  native/process.bas:44, fb.process.spawn:
(#1)  Spawn() init
(#1)  native/process.bas:52, fb.process.spawn:
(#1)  AllocConsole failed, maybe already allocated, safely to discart.
(#1)  native/process.bas:105, fb.process.spawn:
(#1)  Creating child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024
(#1)  native/process.bas:121, fb.process.spawn:
(#1)  Closing handles.
(#1)  native/process.bas:136, fb.process.spawn:
(#1)  wait_code: 258
(#1)  native/process.bas:141, fb.process.spawn:
(#1)  New children PID: 3984
(#1)  native/process.bas:156, fb.process.spawn:
(#1)  Spawn() done
(#1)  native/mongrel_service.bas:79, mongrel_service.single_oninit:
(#1)  child process pid: 3984
(#1)  native/mongrel_service.bas:88, mongrel_service.single_oninit:
(#1)  single_onInit() done
(#1)  native/mongrel_service.bas:93, mongrel_service.single_onstart:
(#1)  single_onStart()

*** Ok, now a bad start (w/ prefix) ***
(#2)  # Logfile created on 05/02/2007 23:38:28
(#2)  native/mongrel_service.bas:148, mongrel_service.application:
(#2)  ServiceHost RunAsService

(#2)  native/mongrel_service.bas:54, mongrel_service.single_oninit:

(#2)  single_onInit()
(#2)  native/mongrel_service.bas:71, mongrel_service.single_oninit:
(#2)  starting child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024 --prefix /wingate
(#2)  # Logfile created on 05/02/2007 23:38:28
(#2)  native/process.bas:44, fb.process.spawn:
(#2)  Spawn() init
(#2)  native/process.bas:52, fb.process.spawn:
(#2)  AllocConsole failed, maybe already allocated, safely to discart.
(#2)  native/process.bas:105, fb.process.spawn:
(#2)  Creating child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024 --prefix /wingate
(#2)  native/process.bas:121, fb.process.spawn:
(#2)  Closing handles.
(#2)  native/process.bas:136, fb.process.spawn:
(#2)  wait_code: 0
(#2)  native/process.bas:147, fb.process.spawn:
(#2)  failed, the process terminate earlier.
(#2)  native/process.bas:156, fb.process.spawn:
(#2)  Spawn() done
(#2)  native/mongrel_service.bas:88, mongrel_service.single_oninit:
(#2)  single_onInit() done


*** Interleaved together ***
(#1)  # Logfile created on 05/02/2007 23:37:42
(#2)  # Logfile created on 05/02/2007 23:38:28
(#1)  native/mongrel_service.bas:148, mongrel_service.application:
(#2)  native/mongrel_service.bas:148, mongrel_service.application:
(#1)  ServiceHost RunAsService
(#2)  ServiceHost RunAsService

(#1)  native/mongrel_service.bas:54, mongrel_service.single_oninit:
(#2)  native/mongrel_service.bas:54, mongrel_service.single_oninit:

(#1)  single_onInit()
(#2)  single_onInit()

(#1)  native/mongrel_service.bas:71, mongrel_service.single_oninit:
(#2)  native/mongrel_service.bas:71, mongrel_service.single_oninit:
(#1)  starting child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024
(#2)  starting child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024 --prefix /wingate
(#1)  # Logfile created on 05/02/2007 23:37:42
(#2)  # Logfile created on 05/02/2007 23:38:28
(#1)  native/process.bas:44, fb.process.spawn:
(#2)  native/process.bas:44, fb.process.spawn:
(#1)  Spawn() init
(#2)  Spawn() init
(#1)  native/process.bas:52, fb.process.spawn:
(#2)  native/process.bas:52, fb.process.spawn:
(#1)  AllocConsole failed, maybe already allocated, safely to discart.
(#2)  AllocConsole failed, maybe already allocated, safely to discart.
(#1)  native/process.bas:105, fb.process.spawn:
(#2)  native/process.bas:105, fb.process.spawn:
(#1)  Creating child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024
(#2)  Creating child process with cmdline:
ruby.exec:\ruby\bin\mongrel_rails start -e production -p 4001 -a
0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c
c:/projects/rails-prod/wingate -t 0 -r public -n 1024 --prefix /wingate
(#1)  native/process.bas:121, fb.process.spawn:
(#2)  native/process.bas:121, fb.process.spawn:
(#1)  Closing handles.
(#2)  Closing handles.
(#1)  native/process.bas:136, fb.process.spawn:
(#2)  native/process.bas:136, fb.process.spawn:


## This is where they start to diverge!
(#1)  wait_code: 258
(#2)  wait_code: 0
(#2)  native/process.bas:147, fb.process.spawn:
(#2)  failed, the process terminate earlier.
(#2)  native/process.bas:156, fb.process.spawn:
(#2)  Spawn() done
(#2)  native/mongrel_service.bas:88, mongrel_service.single_oninit:
(#2)  single_onInit() done

(#1)  native/process.bas:141, fb.process.spawn:
(#1)  New children PID: 3984
(#1)  native/process.bas:156, fb.process.spawn:
(#1)  Spawn() done
(#1)  native/mongrel_service.bas:79, mongrel_service.single_oninit:
(#1)  child process pid: 3984
(#1)  native/mongrel_service.bas:88, mongrel_service.single_oninit:
(#1)  single_onInit() done
(#1)  native/mongrel_service.bas:93, mongrel_service.single_onstart:
(#1)  single_onStart()

Can anyone shed any light on the wait_code bit? Is it not waiting long
enough or is that jsut a return code? I've re-booted, cleared my logs,
created user accounts, treid passing --prefix as a start parm in the
properties view of the service. Nothing seems to work. I would really
appreciate some advice.

Thank you!
-Bridout
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070206/6e91f26e/attachment-0001.html 


More information about the Mongrel-users mailing list