« Previous Next »

Thread: handling termination in FastCGI (FCGX_Accept not working as documented)

Last post 12-11-2008 4:22 AM by Mike Trader. 0 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (1 items)

Sort Posts:

  • 12-11-2008, 4:22 AM

    handling termination in FastCGI (FCGX_Accept not working as documented)

    Regardless of whether i set FCGI_FAIL_ACCEPT_ON_INTR or not, I cannot get any return from

    FCGX_Accept_r() when my FCGI process is closed by the host (due to timout for example)

    searching this forum returns no posts but a google search returns:

    http://osdir.com/ml/web.fastcgi.devel/2007-12/msg00002.html
    > I have a signal handler that catches SIGTERM and sets sig_int_flag to 1.
    > Regardless of whether I use the FCGI_FAIL_ACCEPT_ON_INTR setting or not,
    > the signal is caught but it never breaks out of the loop and executes
    > the cleanup code. What I want to do is have the loop exit and run the
    > cleanup code but I am not sure how to do that with or without the
    > FCGI_FAIL_ACCEPT_ON_INTR setting.

     

     http://www.nabble.com/FCGI_FAIL_ACCEPT_ON_INTR-td7699287.html

    > It should work out of the box under Unix, however as
    > FCGI_FAIL_ACCEPT_ON_INTR is not supported under windows in the
    > official devel package a patch is required. 

    Is this true?

    What I want to do is have the loop exit and run the
    cleanup code...
    http://mlblog.osdir.com/web.fastcgi.devel/2006-12/index.shtml
     
    Am I missing a way to implement this behaviour under IIS? 
     

    http://article.gmane.org/gmane.comp.web.fastcgi.devel/850

    Is there a SIG TERM handler in libfcgi.dll?

     

    It seems this alos leads to 500 errors

    http://www.fastcgi.com/archives/fastcgi-developers/2008-October/000099.html

     

     Documentation states:
    http://www.fastcgi.com/devkit/doc/FCGI_Accept.3 
     

    ' The FCGI_Accept function accepts a new request from the HTTP server ' and creates a CGI-compatible execution environment for the request.

    'If the application was invoked as a CGI program, the first call to FCGI_Accept 'is essentially a no-op and the second call returns -1. 'This causes a correctly coded FastCGI application to run a single request 'and exit, giving CGI behavior. ' 'If the application was invoked as a FastCGI server, the first call to FCGI_Accept 'indicates that the application has completed its initialization and is ready to 'accept its first request. 'Subsequent calls to FCGI_Accept indicate that the application has completed 'processing its current request and is ready to accept a new request.

    'After accepting a new request, FCGI_Accept assigns new values to the 'global variables: stdin, stdout, stderr, and environ. 'After FCGI_Accept returns, these variables have the same interpretation 'as on entry to a CGI program.

    This works as advertised

     

    'The FCGI_Accept blocks execution until a client request comes in, and then returns 0. 'If there is a system failure, or the system administrator terminates 'the process, Accept will return -1.

    This does not work. When the timer triggers, IIS shute the FastCG process down immediately and my cleanup code cannot execute.

     

     

     

     

Page 1 of 1 (1 items)
Microsoft Communities