Hunter Peress
2006-Jan-03 21:56 UTC
Max Execution Time with fastcgi (and in general). Getting it done.
The purpose of this email is not to argue that there is a need to have the option of killing a single response if it takes longer than say 30 seconds. This is a worthwhile feature, years of work in php has shown me that it is. Thanks to a bit of help from various source in the community, I''ve been able to find something that works with fastcgi and surely should work with webbrick. I tried -idle-timeout with the FastCgiConfig/FastCgiServer directives and they failed, eg FastCgiServer /www/vhosts/whatever/public/dispatch.fcgi -idle-timeout 30 left me with dispatch.fcgi still using up 98% of the cpu on my intentional infinite loop test. I tried require "timeout" and Timeout::timeout(2){ logger.info(''im here'') } in dispatch.fcgi and that failed (pretty sure). What did work came by suggestion. In an ApplicationController do: def process(*args) timeout(30) { logger.info(''killed by me''); super } end and it seems that it only takes care of one response (did some testing). But, I would like if someone could point out the error in my FastCgiServer attempt. Thanks. ------------------------------------------------------------------------ Hunter Peress hunterp@sfnewmexican.com Web Programmer The Santa Fe New Mexican, Inc. www.freenewmexican.com
Hunter Peress
2006-Jan-09 23:24 UTC
[Rails] Max Execution Time with fastcgi (and in general). Looking for more elegant fix.
Thanks to a bit of help from various source in the community, I''ve been able to find something that works with fastcgi and surely should work with webbrick. I tried -idle-timeout with the FastCgiConfig/FastCgiServer directives and they failed, eg FastCgiServer /www/vhosts/whatever/public/dispatch.fcgi -idle-timeout 30 left me with dispatch.fcgi still using up 98% of the cpu on my intentional infinite loop test. I tried require "timeout" and Timeout::timeout(2){ logger.info(''im here'') } in dispatch.fcgi and that failed (pretty sure). What did work came by suggestion. In an ApplicationController do: def process(*args) timeout(30) { logger.info(''killed by me''); super } end and it seems that it only takes care of one response (did some testing). But, I would like if someone could point out the error in my FastCgiServer attempt. Thanks. ------------------------------------------------------------------------ Hunter Peress hunterp@sfnewmexican.com Web Programmer The Santa Fe New Mexican, Inc. www.freenewmexican.com