Ralf Vitasek
2007-Sep-10 15:09 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
i was suffering from a massive memory leak in my application. after searching and testing for quite a while i finally found that it wasn''t my app that had a leak but the win32ole support that was used by the ADO driver in sqlserver adapter. the solution to fix the leak was to install ruby 1.8.5p52 or 1.8.6p36 but sadly as soon i install one of the fixed releases mongrel won''t start as service anymore. the latest version i was able to run as a service is 1.8.5p35 but that doesn''t have the leak fixed. "mongrel_rails start" will run the app in dev or production mode on the console without problems. when trying to start the service in mmc it fails with the message that the service was started and that it stopped right away. when running mongrel_service.exe with the "console" option: ### C:\informer_rails>"c:/ruby/bin/mongrel_service.exe" console -e development -p 30 00 -a 0.0.0.0 -l "log/mongrel.log" -P "log/mongrel.pid" -c "c:/informer_rails" - t 0 -r "public" -n 1024 Mongrel Win32 Service, version 0.3.1 (c) 2006 The Mongrel development team. Starting service ''single'' in console mode, please wait... Service is in running state. Press Ctrl-C to stop it. ### i see a ruby.exe for a second in the task manager that seems to die right away. no log files are created. i also wonder why it says "Mongrel Win32 Service, version 0.3.1" because i have 0.3.2 installed. i tried uninstalling and then reinstalling mongrel, mongrel_service and win32-service without any luck. and the error doesn''t seem to come from win32-service as i''m able to run an acts_as_ferret serving DRb without any problems with every ruby version. please check the attached servicefb.log and mongrel_service.log as i can''t see anything wrong in those logs. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: servicefb.log Url: http://rubyforge.org/pipermail/mongrel-users/attachments/20070910/4689b21f/attachment.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: mongrel_service.log Url: http://rubyforge.org/pipermail/mongrel-users/attachments/20070910/4689b21f/attachment-0001.pl
Jano Svitok
2007-Sep-10 16:56 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/10/07, Ralf Vitasek <neongrau at gmail.com> wrote:> i also wonder why it says "Mongrel Win32 Service, version 0.3.1" > because i have 0.3.2 installed. i tried uninstalling and then > reinstalling mongrel, mongrel_service and win32-service without any > luck.It''s a bug in the service code: http://mongrel.rubyforge.org/svn/trunk/projects/mongrel_service/native/mongrel_service.bi No need to worry. I''ve reported to http://rubyforge.org/tracker/index.php?func=detail&aid=13823&group_id=1306&atid=5145
Luis Lavena
2007-Sep-10 19:05 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/10/07, Ralf Vitasek <neongrau at gmail.com> wrote:> i was suffering from a massive memory leak in my application. after > searching and testing for quite a while i finally found that it wasn''t > my app that had a leak but the win32ole support that was used by the > ADO driver in sqlserver adapter. >Ralf, we need to clarify that win32-service, mongrel and even mongrel_service are quite different stuff from quite different developers.> the solution to fix the leak was to install ruby 1.8.5p52 or 1.8.6p36 > > but sadly as soon i install one of the fixed releases mongrel won''t > start as service anymore. > > the latest version i was able to run as a service is 1.8.5p35 but that > doesn''t have the leak fixed. > > "mongrel_rails start" will run the app in dev or production mode on > the console without problems. > > when trying to start the service in mmc it fails with the message that > the service was started and that it stopped right away. > > when running mongrel_service.exe with the "console" option: > ### > C:\informer_rails>"c:/ruby/bin/mongrel_service.exe" console -e development -p 30 > 00 -a 0.0.0.0 -l "log/mongrel.log" -P "log/mongrel.pid" -c "c:/informer_rails" - > t 0 -r "public" -n 1024 > Mongrel Win32 Service, version 0.3.1 > (c) 2006 The Mongrel development team. > > Starting service ''single'' in console mode, please wait... > Service is in running state. > Press Ctrl-C to stop it. > ### > > i see a ruby.exe for a second in the task manager that seems to die > right away. no log files are created. > > i also wonder why it says "Mongrel Win32 Service, version 0.3.1" > because i have 0.3.2 installed. i tried uninstalling and then > reinstalling mongrel, mongrel_service and win32-service without any > luck. >Version 0.3.1 was a error in the definition headers, my mistake.> and the error doesn''t seem to come from win32-service as i''m able to > run an acts_as_ferret serving DRb without any problems with every ruby > version. >For the record, the problem with win32-service was not able to serve Rails application properly, for other ruby tasks, it works fine. Also, mongrel_service only uses win32-service to install/remove the service from the SCM, nothing else.> please check the attached servicefb.log and mongrel_service.log > as i can''t see anything wrong in those logs. >>From mongrel_service.log, could you try running this command line?ruby.exe c:\ruby\bin\mongrel_rails start -e development -p 3000 -a 0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c c:/informer_rails -t 0 -r public -n 1024 It seems it''s trying to run ruby.exe from the PATH, maybe you don''t have it in your environment variables? Latest version (0.3.2) properly uses C:\ruby\bin\ruby.exe as ruby executable. For get that fixes, you need to remove and reinstall the service. Sorry the troubles, and please let us know if that help you :-) -- 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
Ralf Vitasek
2007-Sep-11 08:39 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
hello luis! thank you very much for your reply.>/ From mongrel_service.log, could you try running this command line?/> ruby.exe c:\ruby\bin\mongrel_rails start -e development -p 3000 -a> 0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c c:/informer_rails -t > 0 -r public -n 1024as i said before starting via "mongrel_rails" works with every ruby version. but i tested again to be correct. so YES this works!> It seems it''s trying to run ruby.exe from the PATH, maybe you don''t > have it in your environment variables?ruby is in PATH, as i said before the problem is that ruby.exe starts but just dies right away when started as a service with the latest patchlevel> Latest version (0.3.2) properly uses C:\ruby\bin\ruby.exe as ruby executable. > For get that fixes, you need to remove and reinstall the service.as i said, already tried uninstalling and reinstalling everything before (3 times already, please don''t ask me to try again, i hardly doubt it''ll change anything).> Sorry the troubles, and please let us know if that help you :-)no, thanks for trying to walk me through but sorry, that didn''t really help :-( let me summarize the problem again: the service dies right away, without creating any logs in the rails log dir when using the latest patchlevel ruby version with the win32ole fix ( http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7553&group_id=426 ). running the app via "mongrel_rails start" works with EVERY version. i just need to copy over the zipped ruby version into c:\ruby to see the problem 1.8.5p35 -> service works copy 1.8.5p52 into c:\ruby -> doesnt work anymore copy 1.8.5p35 back into c:\ruby -> works again copy 1.8.6p36 into c:\ruby -> doesnt work anymore copy 1.8.6 into c:\ruby -> work again please try this ruby release: ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.5-p52-i386-mswin32.zip (this is the latest version with the memory leak fixed) or in case you''re using 1.8.6 ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.6-p36-i386-mswin32.zip and for the record: these are the latest ruby versions that will get the services to run: ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.5-p35-i386-mswin32.zip or ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.6-i386-mswin32.zip i hope this clears things more up. cheers, ralf
Luis Lavena
2007-Sep-11 21:28 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/11/07, Ralf Vitasek <neongrau at gmail.com> wrote:> hello luis! > > thank you very much for your reply. > > >/ From mongrel_service.log, could you try running this command line? > /> ruby.exe c:\ruby\bin\mongrel_rails start -e development -p 3000 -a > > 0.0.0.0 -l log/mongrel.log -P log/mongrel.pid -c c:/informer_rails -t > > 0 -r public -n 1024 > > as i said before starting via "mongrel_rails" works with every ruby version. > but i tested again to be correct. so YES this works! > > > > It seems it''s trying to run ruby.exe from the PATH, maybe you don''t > > have it in your environment variables? > > ruby is in PATH, as i said before the problem is that ruby.exe starts > but just dies right away when started as a service with the latest patchlevel >So far, everything is ok in the ruby land...> > Latest version (0.3.2) properly uses C:\ruby\bin\ruby.exe as ruby executable. > > For get that fixes, you need to remove and reinstall the service. > > as i said, already tried uninstalling and reinstalling everything before > (3 times already, please don''t ask me to try again, i hardly doubt it''ll change anything). >No problem, I''ll not ;-)> > let me summarize the problem again: > > the service dies right away, without creating any logs in the rails log dir > when using the latest patchlevel ruby version with the win32ole fix > ( http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7553&group_id=426 ). > > running the app via "mongrel_rails start" works with EVERY version. > i just need to copy over the zipped ruby version into c:\ruby to see the problem > 1.8.5p35 -> service works > copy 1.8.5p52 into c:\ruby -> doesnt work anymore > copy 1.8.5p35 back into c:\ruby -> works again > copy 1.8.6p36 into c:\ruby -> doesnt work anymore > copy 1.8.6 into c:\ruby -> work again >Mmm, you''re using win32ole to connect to ADO driver, right? Maybe there is a problem due the non-impersonation of the service, since by default it will run as SYSTEM, and not the user you''re logged in. This often bring problems when dealing with ActiveX/OLE and the proper creation of instances of these objects.> > please try this ruby release: > ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.5-p52-i386-mswin32.zip > (this is the latest version with the memory leak fixed) > > or in case you''re using 1.8.6 > ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.6-p36-i386-mswin32.zip >I''m using 1.8.5 patchlevel 12, since I self-compiled it. I''ll give a try but doubt will found any problem, mostly since I don''t use Win32OLE fo my rails projects.> i hope this clears things more up. >Maybe you could contact me off the list and give me some insight of your setup that I could replicate here. One thing we left out of testing is the RunAs... could you go to the SCM (Service Control Manager) and change the Account used by your rails application? Try setting it as your local/user account and see what happens. -- 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
Ralf Vitasek
2007-Sep-12 06:59 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/11/07, Luis Lavena <luislavena at gmail.com> wrote:> Mmm, you''re using win32ole to connect to ADO driver, right?yes, i even tried hacking the ADO.rb to use SQLNCLI instead of SQLOLEDB but same behavior with that one. and i''m tied to the ADO driver since the ODBC driver won''t work too many SQL statements don''t work there and hard crash the my rails app due to weird out of memory errors already when indexing a model with acts_as_ferret.> Maybe there is a problem due the non-impersonation of the service, > since by default it will run as SYSTEM, and not the user you''re logged > in.forgot to mention i tired that already, makes no difference. same behavior shows up when starting the mongrel_service.exe with the console switch so i''m pretty sure it''s using the same local user as when starting the app via mongrel_rails directly (which works).> I''m using 1.8.5 patchlevel 12, since I self-compiled it. I''ll give a > try but doubt will found any problem, mostly since I don''t use > Win32OLE fo my rails projects.i''m only using it with the sqlserver adapter, nowhere else. what i haven''t tried yet was if the problem also shows when using a different db adapter. i''m gonna test this today with ODBC and or a test app with mysql.> Maybe you could contact me off the list and give me some insight of > your setup that I could replicate here.sure, what do you need to know? i''m using rails 1.2.3, my DB runs on MS SQL 2005 (Standard). the problem showed up on Windows XP prof. and Windows Server 2003 i''ll do whatever i can to help getting this issue fixed. already took me 2 weeks to find the cause of my memory leak and finding a fixed version (sadly ruby-lang.org is still offering the old unfixed versions on their download page). cheers, ralf
Ralf Vitasek
2007-Sep-14 15:05 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
hello luis! in the meantime i''ve done some more tests and i''m pretty sure the problem has nothing to do with win32ole. i switched to ODBC mode and observed the same behavior as with the win32ole driven ADO driver. and by creating a new plain rails app that was using a mysql 5 database the problem showed up the same. meaning as soon as i copy back one of the previous ruby builds the service will start up fine. sadly the only message i get after "net start testrails" is to call NET HELPMSG 3534 for more details :( have you yet been able to test one of the latest builds? or is there anything else you want me to check or provide infos? cheers, ralf
Jano Svitok
2007-Sep-14 15:34 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/14/07, Ralf Vitasek <neongrau at gmail.com> wrote:> hello luis! > > in the meantime i''ve done some more tests and i''m pretty sure the > problem has nothing to do with win32ole. > > i switched to ODBC mode and observed the same behavior as with the > win32ole driven ADO driver. > > and by creating a new plain rails app that was using a mysql 5 > database the problem showed up the same. meaning as soon as i copy > back one of the previous ruby builds the service will start up fine.I don''t remember the whole story here, just offering few tips: 1. add some tracing to mongrel.rb (and possibly to mongrel.bat/cmd, depending on what''s called when staring the service) 2. use ProcExp to see if ruby.exe starts at all. 3. use DbgView to see if there are any debug messages that could help 4. use full path wherever possible, don''t rely on proper PATH. J.
Luis Lavena
2007-Sep-14 21:00 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/14/07, Ralf Vitasek <neongrau at gmail.com> wrote:> hello luis! > > in the meantime i''ve done some more tests and i''m pretty sure the > problem has nothing to do with win32ole. >Good to know, this narrow the problem a bit...> i switched to ODBC mode and observed the same behavior as with the > win32ole driven ADO driver. > > and by creating a new plain rails app that was using a mysql 5 > database the problem showed up the same. meaning as soon as i copy > back one of the previous ruby builds the service will start up fine. >If I remember correctly, some versions of ruby works, some others don''t....> sadly the only message i get after "net start testrails" is to call > NET HELPMSG 3534 > for more details :( >Yeah, it''s windows, the less informative OS.> have you yet been able to test one of the latest builds? > or is there anything else you want me to check or provide infos? >With all the info you gather will be able to test it tonight, since I was overloaded with things outside the office the past days. -- 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
Luis Lavena
2007-Sep-15 03:52 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/14/07, Ralf Vitasek <neongrau at gmail.com> wrote:> hello luis! > > in the meantime i''ve done some more tests and i''m pretty sure the > problem has nothing to do with win32ole. >You''re Right!!!! It seems that running in console mode also fails (for the versions you listed with problems). I''m hooking a simple logger into mongrel_service to trace the problem inside ruby (and see if it reports something). I don''t know what was "fixed" in the latest patchlevel release of 1.8.5, but it seems something "broke" :-P -- 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
Luis Lavena
2007-Sep-15 04:51 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/15/07, Luis Lavena <luislavena at gmail.com> wrote:> On 9/14/07, Ralf Vitasek <neongrau at gmail.com> wrote: > > hello luis! > > > > in the meantime i''ve done some more tests and i''m pretty sure the > > problem has nothing to do with win32ole. > > > > You''re Right!!!! > > It seems that running in console mode also fails (for the versions you > listed with problems). > > I''m hooking a simple logger into mongrel_service to trace the problem > inside ruby (and see if it reports something). > > I don''t know what was "fixed" in the latest patchlevel release of > 1.8.5, but it seems something "broke" :-P >Ok, let just try something: Please, download the following file: http://mmediasys.com/mongrel/mongrel_service-0.3.3-mswin32.gem Before install it, please remove the 0.3.2 of mongrel_service gem (Also, manually remove the mongrel_service.exe and the related log files from ruby\bin folder). Install it, and reinstall the service (or test with a dummy/empty rails application). NOTE: You need to install a new service for the updated mongrel_service executable get copied in ruby\bin, without it, nothing will work. Now, try starting your service with net start and also in console mode. I''ve tested with patchlevel 52 and 12 of 1.8.5, with both versions works. This experimental version includes back ported code from upcoming project. If this works for you, I''ll commit the changes to the SVN and release the updated version. Also, check C:\Ruby\bin\services.log This is still to rough, but there is logged the STDOUT/STDERR pipes for Mongrel. (Should be inside your application log folder, but didn''t have the time to back port my OptionParser to mongrel_service). Let me know any problems (and hope success too!). 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
Luis Lavena
2007-Sep-15 04:56 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
On 9/15/07, Luis Lavena <luislavena at gmail.com> wrote:> > http://mmediasys.com/mongrel/mongrel_service-0.3.3-mswin32.gem >Damn, my host didn''t serve the file as binary... so, please download this: http://mmediasys.com/mongrel/mongrel_service-0.3.3-mswin32.gem.bin the .bin is just a dummy extension, rename it to just .gem and will work ;-) Regards and good weekend everybody. -- 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
Ralf Vitasek
2007-Sep-15 10:08 UTC
[Mongrel] mongrel_rails service on windows incompatible with recent ruby builds?
GREAT JOB! it works! :) thank you so much!!! cheers, ralf On 9/15/07, Luis Lavena <luislavena at gmail.com> wrote:> On 9/15/07, Luis Lavena <luislavena at gmail.com> wrote: > > > > http://mmediasys.com/mongrel/mongrel_service-0.3.3-mswin32.gem > > > > Damn, my host didn''t serve the file as binary... so, please download this: > > http://mmediasys.com/mongrel/mongrel_service-0.3.3-mswin32.gem.bin > > the .bin is just a dummy extension, rename it to just .gem and will work ;-) > > Regards and good weekend everybody. > > -- > 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 >