Guy Ridout
2007-Feb-06 05:22 UTC
[Mongrel] Mongrel service will not start on win32 w/ --prefix option
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
Luis Lavena
2007-Feb-06 06:26 UTC
[Mongrel] Mongrel service will not start on win32 w/ --prefix option
Hello Guy, I''ll try to answer your questions: On 2/6/07, Guy Ridout <ridoutspam at gmail.com> wrote:> 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. >I see that you''re using latest mongrel_service, that''s good. I''ll snip the content now, but so far, this is the best report of a problem someone made under Win32! Congrats!> > 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" > >As you can see, the only params that fails (based on mongrel_service.log) is --prefix.> ## 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 > > 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. >The wait code indicates that process is starting, and wait_code = 0 means something is wrong during process spawning. My advice will be try running plain mongrel command and see what ruby process dump to the screen, so the command you can run in a command prompt window (cmd) will be: ruby.exe c:\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 The bad thing is in the current implementation, mongrel_service isn''t logging the console output of the child process, so this is the only way to pin-point the problem. Please copy the output you get from this in your next reply. So far, mongrel process is failing to start, guess is directly related to prefix option, and if thats the case, a prefix test under win32 should be added. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi
Guy Ridout
2007-Feb-06 13:40 UTC
[Mongrel] Mongrel service will not start on win32 w/ --prefix option
Luis, I truly appreciate the quick reply and your eagerness to help. It''s refreshing to have software w/ service! Thank you. I tried running the command you suggest: C:\projects\rails-prod\wingate>ruby.exe c:\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 INVALID COMMAND: invalid option: --prefix It fails saying there is no --prefix option. Thinking maybe I don''t have the latest version, I did the following: C:\projects\rails-prod\wingate>gem update mongrel_service Updating installed gems... Need to update 23 gems from http://gems.rubyforge.org ....................... complete Attempting remote update of mongrel_service Select which gem to install for your platform (i386-mswin32) 1. mongrel_service 0.3.1 (mswin32) 2. mongrel_service 0.1 (ruby) 3. Cancel installation> 1Successfully installed mongrel_service-0.3.1-mswin32 Installing ri documentation for mongrel_service-0.3.1-mswin32... Installing RDoc documentation for mongrel_service-0.3.1-mswin32... Gems: [mongrel_service] updated Following this update, the command fails with the same message. Any ideas? Btw, I apologize if this post breaks the original thread. I''m a mailing list newbie, and I didn''t have my email settings correct, so there is nothing I can reply to (assuming that is what I''m supposed to do!). -BR -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070206/5ae55ee1/attachment-0001.html
Luis Lavena
2007-Feb-06 14:57 UTC
[Mongrel] Mongrel service will not start on win32 w/ --prefix option
On 2/6/07, Guy Ridout <ridoutspam at gmail.com> wrote:> Luis, I truly appreciate the quick reply and your eagerness to help. It''s > refreshing to have software w/ service! Thank you. > > I tried running the command you suggest: > > C:\projects\rails-prod\wingate>ruby.exe c:\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 > INVALID COMMAND: invalid option: --prefix > > It fails saying there is no --prefix option. Thinking maybe I don''t have the > latest version, I did the following: > > C:\projects\rails-prod\wingate>gem update mongrel_service > Updating installed gems... > Need to update 23 gems from http://gems.rubyforge.org > ....................... > complete > Attempting remote update of mongrel_service > Select which gem to install for your platform (i386-mswin32) > 1. mongrel_service 0.3.1 (mswin32) > 2. mongrel_service 0.1 (ruby) > 3. Cancel installation > > 1 > Successfully installed mongrel_service-0.3.1-mswin32 > Installing ri documentation for mongrel_service-0.3.1-mswin32.. . > Installing RDoc documentation for mongrel_service-0.3.1-mswin32... > Gems: [mongrel_service] updated > > Following this update, the command fails with the same message. Any ideas? >Mmm, did you update mongrel gem too? $ gem install mongrel --include-dependencies Mongrel version should be 1.0.1 You should notice the "Mounting Rails at ..." line in the output:>mongrel_rails start --prefix /test** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Mounting Rails at /test... D:0:Warning: require_gem is obsolete. Use gem instead. ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. INT => stop (no restart). ** Mongrel available at 0.0.0.0:3000 ** Use CTRL-C to stop. I tried the same here and it worked, maybe you have an older mongrel version.> Btw, I apologize if this post breaks the original thread. I''m a mailing list > newbie, and I didn''t have my email settings correct, so there is nothing I > can reply to (assuming that is what I''m supposed to do!). >Its good that you bring this to mongrel list, we all started as newbies ;-) try replying to the last mail you get in the same thread (ex, mine, no mater it the Topic get modified with ''re:'' by your mail software). -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi
Guy Ridout
2007-Feb-07 05:46 UTC
[Mongrel] Mongrel service will not start on win32 w/ --prefix option
Updating the mongrel gem ($ gem update mongrel --include-dependencies) did the trick. Thanks again for your help. I definitely owe you a drink! -BR :) On 2/6/07, Luis Lavena <luislavena at gmail.com> wrote:> > On 2/6/07, Guy Ridout <ridoutspam at gmail.com> wrote: > > Luis, I truly appreciate the quick reply and your eagerness to help. > It''s > > refreshing to have software w/ service! Thank you. > > > > I tried running the command you suggest: > > > > C:\projects\rails-prod\wingate>ruby.exe c:\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 > > INVALID COMMAND: invalid option: --prefix > > > > It fails saying there is no --prefix option. Thinking maybe I don''t have > the > > latest version, I did the following: > > > > C:\projects\rails-prod\wingate>gem update mongrel_service > > Updating installed gems... > > Need to update 23 gems from http://gems.rubyforge.org > > ....................... > > complete > > Attempting remote update of mongrel_service > > Select which gem to install for your platform (i386-mswin32) > > 1. mongrel_service 0.3.1 (mswin32) > > 2. mongrel_service 0.1 (ruby) > > 3. Cancel installation > > > 1 > > Successfully installed mongrel_service-0.3.1-mswin32 > > Installing ri documentation for mongrel_service-0.3.1-mswin32.. . > > Installing RDoc documentation for mongrel_service-0.3.1-mswin32... > > Gems: [mongrel_service] updated > > > > Following this update, the command fails with the same message. Any > ideas? > > > > Mmm, did you update mongrel gem too? > > $ gem install mongrel --include-dependencies > > Mongrel version should be 1.0.1 > > You should notice the "Mounting Rails at ..." line in the output: > > >mongrel_rails start --prefix /test > ** Starting Mongrel listening at 0.0.0.0:3000 > ** Starting Rails with development environment... > ** Mounting Rails at /test... > D:0:Warning: require_gem is obsolete. Use gem instead. > ** Rails loaded. > ** Loading any Rails specific GemPlugins > ** Signals ready. INT => stop (no restart). > ** Mongrel available at 0.0.0.0:3000 > ** Use CTRL-C to stop. > > > I tried the same here and it worked, maybe you have an older mongrel > version. > > > Btw, I apologize if this post breaks the original thread. I''m a mailing > list > > newbie, and I didn''t have my email settings correct, so there is nothing > I > > can reply to (assuming that is what I''m supposed to do!). > > > > Its good that you bring this to mongrel list, we all started as newbies > ;-) > try replying to the last mail you get in the same thread (ex, mine, no > mater it the Topic get modified with ''re:'' by your mail software). > > -- > Luis Lavena > Multimedia systems > - > Leaders are made, they are not born. They are made by hard effort, > which is the price which all of us must pay to achieve any goal that > is worthwhile. > Vince Lombardi > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070207/b8f482a5/attachment-0001.html