chiark / gitweb /
cgi-fcgi-interp: new garbage collection approach, spec
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Mar 2016 21:46:09 +0000 (21:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 29 Mar 2016 18:32:50 +0000 (19:32 +0100)
cprogs/cgi-fcgi-interp.c

index 752db40897652a9955cc0757a48860298b726fdc..bfcfd9afe546e0719ceb519cf24cd2f7e7e1698a 100644 (file)
  *         speedy, the specified number of servers is started
  *         right away.)  The default is 4.
  *
+ *  -c<interval>
+ *         Stale server check interval, in seconds.  The worker
+ *         process group will get a SIGTERM when it is no longer
+ *         needed to process new requests.  Ideally it would continue
+ *         to serve any existing requests.  The SIGTERM will arrive no
+ *         earlier than <interval> after the last request arrived at
+ *         the containing webserver.  Default is 300.
+ *
  *  -D
  *         Debug mode.  Do not actually run program.  Instead, print
  *         out what we would do.
  *  - check for and maybe create <base>
  *  - stat and lstat the <script>
  *  - stat the socket and check its timestamp
- *       if it is too old, rename it to g<inum>.<pid> (where
- *       <inum> and <pid> are in decimal)
- *       and run garbage collection
- *  - run  cgi-fcgi -connect SOCKET SCRIPT
+ *       if it is too old, unlink it
+ *  - dup2 stderr, mark no cloexec
+ *  - run  cgi-fcgi -connect SOCKET \
+ *        cgi-fcgi-interp --stage2 <was-stderr> <socket> <interp> <script>
+ *
+ * -E<was-stderr> does this:
+ *  - dup2 <was-stderr> to fd 2
+ *  - open /dev/null and expect fd 1 (and if not, close it)
+ *  - become a new process group
+ *  - lstat <socket> to find its inum, mtime
+ *  - fork/exec <interp> <script>
+ *  - periodically lstat <socket> and
+ *      if inum, mtime have changed
+ *      kill process group (at second iteration)
  */
 
 #include "common.h"