Re: [Cppcms-users] How to prevent server goes down when crash?
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2011-08-22 08:27:45
|
> >I didn't work on posix platform. I use microsoft vs to build it and use apache in windows to run it. > > >This is what I did: >1. Added a (*(char *) 0) = 0 in the hello:main() function. This should make process crash when user try to access the URL. >2. Configure hello.exe run as fastcgi mode and start the it as hello.exe -c config.js >3. Configure apache to run hello.exe independently( http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_tut_web_server_config#Apache..FastCGI..Independent.start ) >4. Try to access http://localhost:8080/hello > > >Obviously hello.exe crash and exit. Maybe I ran it as wrong way but I don't fully understand how to run it as multi-thread. > Obviously... The hello runs as independent FastCGI Server and if it crashes it crashes like any other program. I though you told me that "web server" crashes, but hello.exe is not web server. If you want hello.exe to be restarted you need to do it on your own (at least on Windows that does not support fork() system call). Simple bat script can do this for you. You can also configure the web server to control the life time of the "hello.exe", start it, shut it down or restart. This is what described in the link below. http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_tut_web_server_config#Apache..FastCGI..Start.by.Web.Server Thus apache would restart CppCMS service when it crashes for you. AFAIK there are users that run CppCMS this on Windows with Apache that is controlled by Apache and I even get patches for graceful shutdown by apache support. See this thread: http://thread.gmane.org/gmane.comp.lib.cppcms.user/551 Artyom |