--- libapache2-mod-fcgid-2.1.orig/fcgid_pm_main.c +++ libapache2-mod-fcgid-2.1/fcgid_pm_main.c @@ -11,6 +11,7 @@ static int g_busy_timeout; static int g_busy_scan_interval; static int g_proc_lifetime; +static int g_shutdown_timeout; static int g_error_scan_interval; static int g_zombie_scan_interval; @@ -249,6 +250,7 @@ */ void *dummy; fcgid_procnode *previous_node, *current_node, *next_node; + apr_time_t last_active_time; apr_time_t now = apr_time_now(); fcgid_procnode *error_list_header = proctable_get_error_list(); fcgid_procnode *free_list_header = proctable_get_free_list(); @@ -292,19 +294,27 @@ for (current_node = &proc_table[temp_error_header.next_index]; current_node != proc_table; current_node = &proc_table[current_node->next_index]) { + + last_active_time = current_node->last_active_time; + /* Try gracefully first */ dummy = NULL; apr_pool_userdata_get(&dummy, HAS_GRACEFUL_KILL, current_node->proc_pool); if (!dummy) { + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server, + "mod_fcgid: process %" APR_PID_T_FMT + " going graceful shutdown, sending SIGTERM", + current_node->proc_id->pid); proc_kill_gracefully(current_node, main_server); apr_pool_userdata_set("set", HAS_GRACEFUL_KILL, apr_pool_cleanup_null, current_node->proc_pool); - } else { + } else if (apr_time_sec(now) - apr_time_sec(last_active_time) > + g_shutdown_timeout) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, main_server, "mod_fcgid: process %" APR_PID_T_FMT - " graceful kill fail, sending SIGKILL", + " graceful shutdown timeouted, sending SIGKILL", current_node->proc_id->pid); proc_kill_force(current_node, main_server); } @@ -466,6 +476,7 @@ g_zombie_scan_interval = get_zombie_scan_interval(main_server); g_busy_timeout = get_busy_timeout(main_server); g_busy_timeout += 10; + g_shutdown_timeout = get_shutdown_timeout(main_server); while (1) { if (procmgr_must_exit()) --- libapache2-mod-fcgid-2.1.orig/fcgid_conf.c +++ libapache2-mod-fcgid-2.1/fcgid_conf.c @@ -13,6 +13,7 @@ #define DEFAULT_IDLE_SCAN_INTERVAL 120 #define DEFAULT_BUSY_TIMEOUT 300 #define DEFAULT_BUSY_SCAN_INTERVAL 120 +#define DEFAULT_SHUTDOWN_TIMEOUT 20 #define DEFAULT_ERROR_SCAN_INTERVAL 3 #define DEFAULT_ZOMBIE_SCAN_INTERVAL 3 #define DEFAULT_PROC_LIFETIME (60*60) @@ -41,6 +42,7 @@ config->idle_scan_interval = DEFAULT_IDLE_SCAN_INTERVAL; config->busy_scan_interval = DEFAULT_BUSY_SCAN_INTERVAL; config->proc_lifetime = DEFAULT_PROC_LIFETIME; + config->shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT; config->error_scan_interval = DEFAULT_ERROR_SCAN_INTERVAL; config->zombie_scan_interval = DEFAULT_ZOMBIE_SCAN_INTERVAL; config->spawn_score = DEFAULT_SPAWN_SCORE; @@ -158,6 +160,22 @@ return config ? config->busy_timeout : DEFAULT_BUSY_TIMEOUT; } +const char *set_shutdown_timeout(cmd_parms * cmd, void *dummy, const char *arg) +{ + server_rec *s = cmd->server; + fcgid_server_conf *config = + ap_get_module_config(s->module_config, &fcgid_module); + config->shutdown_timeout = atol(arg); + return NULL; +} + +int get_shutdown_timeout(server_rec * s) +{ + fcgid_server_conf *config = + ap_get_module_config(s->module_config, &fcgid_module); + return config ? config->shutdown_timeout : DEFAULT_SHUTDOWN_TIMEOUT; +} + const char *set_busy_scan_interval(cmd_parms * cmd, void *dummy, const char *arg) { --- libapache2-mod-fcgid-2.1.orig/fcgid_conf.h +++ libapache2-mod-fcgid-2.1/fcgid_conf.h @@ -22,6 +22,7 @@ int idle_scan_interval; int busy_scan_interval; int proc_lifetime; + int shutdown_timeout; int error_scan_interval; int zombie_scan_interval; char *sockname_prefix; @@ -89,6 +90,10 @@ const char *arg); int get_proc_lifetime(server_rec * s); +const char *set_shutdown_timeout(cmd_parms * cmd, void *dummy, + const char *arg); +int get_shutdown_timeout(server_rec * s); + const char *set_error_scan_interval(cmd_parms * cmd, void *dummy, const char *arg); int get_error_scan_interval(server_rec * s); --- libapache2-mod-fcgid-2.1.orig/debian/dirs +++ libapache2-mod-fcgid-2.1/debian/dirs @@ -0,0 +1 @@ +usr/lib --- libapache2-mod-fcgid-2.1.orig/debian/docs +++ libapache2-mod-fcgid-2.1/debian/docs @@ -0,0 +1,2 @@ +debian/doc.htm +debian/configuration.htm --- libapache2-mod-fcgid-2.1.orig/debian/libapache2-mod-fcgid.prerm +++ libapache2-mod-fcgid-2.1/debian/libapache2-mod-fcgid.prerm @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +case "$1" in + remove) + test -e /etc/apache2/mods-enabled/fcgid.load && /usr/sbin/a2dismod fcgid + ;; + upgrade|deconfigure|failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 --- libapache2-mod-fcgid-2.1.orig/debian/control +++ libapache2-mod-fcgid-2.1/debian/control @@ -0,0 +1,16 @@ +Source: libapache2-mod-fcgid +Section: web +Priority: optional +Maintainer: Tatsuki Sugiura +Build-Depends: debhelper (>= 4.0.0), apache2-threaded-dev (>= 2.2.3-2), libtool, cdbs, libapr1-dev, pkg-config +Standards-Version: 3.7.2 +Uploaders: Taku YASUI + +Package: libapache2-mod-fcgid +Architecture: any +Depends: ${shlibs:Depends}, apache2.2-common +Description: an alternative module compat with mod_fastcgi + It is a binary compatibility alternative to Apache module mod_fastcgi. + mod_fcgid has a new process management strategy, which concentrates on + reducing the number of fastcgi server, and kick out the corrupt fastcgi + server as soon as possible. --- libapache2-mod-fcgid-2.1.orig/debian/rules +++ libapache2-mod-fcgid-2.1/debian/rules @@ -0,0 +1,29 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# + + +MAKE_DEFS = top_dir=/usr/share/apache2 \ + APXS=apxs2 APACHECTL=apachectl2 \ + INCLUDES="-I$(CURDIR) -I/usr/include/apache2 `pkg-config --cflags apr-1`" + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/makefile.mk + +DEB_FIXPERMS_EXCLUDE = var/lib/apache2/fcgid/sock +DEB_MAKE_INVOKE += $(MAKE_DEFS) +DEB_MAKE_INSTALL_TARGET = + +binary-install/libapache2-mod-fcgid:: + mkdir -p $(CURDIR)/debian/libapache2-mod-fcgid/usr/lib/apache2/modules + install -m 644 .libs/mod_fcgid.so \ + $(CURDIR)/debian/libapache2-mod-fcgid/usr/lib/apache2/modules + mkdir -p $(CURDIR)/debian/libapache2-mod-fcgid/etc/apache2/mods-available + install -m 644 debian/fcgid.load debian/fcgid.conf \ + $(CURDIR)/debian/libapache2-mod-fcgid/etc/apache2/mods-available + mkdir -p $(CURDIR)/debian/libapache2-mod-fcgid/var/lib/apache2/fcgid/sock + chown www-data:www-data \ + $(CURDIR)/debian/libapache2-mod-fcgid/var/lib/apache2/fcgid/sock + chmod 755 \ + $(CURDIR)/debian/libapache2-mod-fcgid/var/lib/apache2/fcgid/sock + --- libapache2-mod-fcgid-2.1.orig/debian/watch +++ libapache2-mod-fcgid-2.1/debian/watch @@ -0,0 +1,8 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# Site Directory Pattern Version Script +version=2 +http://fastcgi.coremail.cn/download.htm \ + mod_fcgid\.([\d.]+)\.tar\.gz \ + debian uupdate --- libapache2-mod-fcgid-2.1.orig/debian/doc.htm +++ libapache2-mod-fcgid-2.1/debian/doc.htm @@ -0,0 +1,103 @@ + + + + + + +The mod_fcgid Home Page + + + + + + + + + + + + + + + + + +
+ +  + + + + + +
+ +Home
+Chinese Info
+Download (source)
+Documentations
+ + +Feedback + + +
+ +
    +
  • + +

    Here are some examples of configuration

    +
  • +
+ +

Configuration for Regular fastcgi +(non-PHP, non-Ruby, non-Python) 

Configuration +for suEXEC fastcgi

Configuration for PHP +(UNIX)

Configuration for suPHP (UNIX)

Configuration +for PHP (Windows)

  +


+
    +
  • There are +some other configurations you can set

    +
  • +
+

IdleTimeout n (300 +seconds)

An idle fastcgi application will be terminated after IdleTimeout +seconds.

IdleScanInterval n (120 seconds)

The scan interval for idle +fastcgi applications.

BusyTimeout n (300 seconds)

a fastcgi +application will be terminated if handing a single request longer than busy +timeout.

BusyScanInterval n (120 seconds)

The scan interval for busy +timeout fastcgi applications.

ErrorScanInterval n (3 seconds)

The +scan interval for exit pending fastcgi applications. fastcgi applications will +be terminated within this scanning.

ZombieScanInterval n (3 seconds)

The +scan interval for zombie process. 

ProcessLifeTime n (3600 seconds)

A +fastcgi application will be terminated if lifetime expired, even no error is +detected.

SocketPath path (logs/fcgidsock)

The directory to put the +UNIX domain socket. (UNIX only)

SpawnScoreUpLimit n (10)

The +spawn-speed control score up water limit. Score increases while a process is spawned or terminated, and decreases +as time progresses; while the score is higher than SpawnScoreUpLimit, the spawning will be +held for a while. The higher this number is, the higher speed of the spawning +can be.

SpawnScore n (1)

The weight of spawning.  This weight +will be plused to the spawn-control score on every spawn. The higher this number +is, the lower speed of spawning can be.

TerminationScore n (2)

The +weight of termination. This weight will be plused to the score while fastcgi +process terminates. The higher this number is, the lower speed of spawning can +be.

MaxProcessCount n (1000)

The max count of total fastcgi process +count.

DefaultMaxClassProcessCount n (100)

The maximum number of +fastcgi application instances allowed to run for any one fastcgi application. 

DefaultMinClassProcessCount n +(3)

The minimum number of +fastcgi application instances for any one fastcgi application. 

DefaultInitEnv  +env_name env_value

The default environment variables before a fastcgi +application is spawned. You can set this configuration more +than once.

IPCConnectTimeout n (3 seconds)

The connect timeout to a +fastcgi application. 

IPCCommTimeout n (20 seconds)

The communication +timeout to a fastcgi application. Please increase this value if your CGI have a +slow initialization or slow respond.

OutputBufferSize n (64k bytes)

CGI +output cache buffer size.

PHP_Fix_Pathinfo_Enable n(n=0/1, default 0)

If +you are using PHP and set cgi.fix_pathinfo=1 in php.ini, set +PHP_Fix_Pathinfo_Enable 1. + +

+ + --- libapache2-mod-fcgid-2.1.orig/debian/changelog +++ libapache2-mod-fcgid-2.1/debian/changelog @@ -0,0 +1,135 @@ +libapache2-mod-fcgid (1:2.1-2) unstable; urgency=medium + + * Add proper dependency by shlibs:Depends (Closes: #427046, #427120) + + -- Tatsuki Sugiura Sat, 02 Jun 2007 18:01:15 +0900 + +libapache2-mod-fcgid (1:2.1-1) unstable; urgency=low + + * New upstream release (Closes: #420910) + * Add SharememPath to default config. Thanks to Philipp Wollermann. + + -- Tatsuki Sugiura Mon, 14 May 2007 02:53:56 +0900 + +libapache2-mod-fcgid (1:1.10-2) unstable; urgency=high + + * rewind upstream version temporary for etch release. (Related: #401938) + + -- Tatsuki Sugiura Wed, 31 Jan 2007 18:25:18 +0900 + +libapache2-mod-fcgid (2.0-1) unstable; urgency=high + + * New upstream release + * Apply NMU Update (Closes: #394473) + + -- Tatsuki Sugiura Wed, 1 Nov 2006 13:28:02 +0900 + +libapache2-mod-fcgid (1.10-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Update for apache 2.2 (Closes: #391757). + * Stop overriding what libtool to use (Closes: #393020). + + -- Luk Claes Sat, 21 Oct 2006 15:36:56 +0200 + +libapache2-mod-fcgid (1.10-1.1~smcv0) unstable; urgency=low + + * Non-maintainer upload. + * Compile against Apache 2.2 and APR 1.0 (Closes: #391757, #393020). + + -- Simon McVittie Sun, 15 Oct 2006 15:17:28 +0100 + +libapache2-mod-fcgid (1.10-1) unstable; urgency=low + + * New upstream release + * Update app kill patch: Rename Directive ErrorTimeout -> ShutdownTimeout + + -- Tatsuki Sugiura Wed, 5 Jul 2006 13:24:02 +0900 + +libapache2-mod-fcgid (1.09-2) UNRELEASED; urgency=low + + * NOT RELEASED YET + + -- Tatsuki Sugiura Mon, 15 May 2006 07:06:17 +0900 + +libapache2-mod-fcgid (1.09-1) unstable; urgency=low + + * New upstream release (Closes: #361975, #361579, #345752) + * Set "IPCConnectTimeout 20" in default config file (Closes: #352498) + + -- Tatsuki Sugiura Mon, 15 May 2006 06:06:03 +0900 + +libapache2-mod-fcgid (1.07-1) unstable; urgency=low + + * New upstream release (Closes: #339604) + * Unnecessary dependency has been removed. Those provied from + apache2-common. (Closes: #334011) + + -- Tatsuki Sugiura Mon, 21 Nov 2005 05:55:39 +0900 + +libapache2-mod-fcgid (1.06-2) UNRELEASED; urgency=low + + * add ErrorTimeout directive for timeout of force kill + + -- Tatsuki Sugiura Wed, 16 Nov 2005 05:47:41 +0900 + +libapache2-mod-fcgid (1.06-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Tue, 16 Aug 2005 07:33:24 +0900 + +libapache2-mod-fcgid (1.05-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Thu, 7 Apr 2005 16:31:07 +0900 + +libapache2-mod-fcgid (1.04-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Sun, 19 Dec 2004 01:43:57 +0900 + +libapache2-mod-fcgid (1.03-2) unstable; urgency=low + + * supports non HTTP_OK status code + + -- Tatsuki Sugiura Thu, 11 Nov 2004 09:37:41 +0900 + +libapache2-mod-fcgid (1.03-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Wed, 10 Nov 2004 17:24:08 +0900 + +libapache2-mod-fcgid (1.02-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Wed, 13 Oct 2004 15:53:34 +0900 + +libapache2-mod-fcgid (1.01-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Sat, 25 Sep 2004 02:20:16 +0900 + +libapache2-mod-fcgid (0.86-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Wed, 25 Aug 2004 15:01:09 +0900 + +libapache2-mod-fcgid (0.80-1) unstable; urgency=low + + * New upstream release + + -- Tatsuki Sugiura Thu, 12 Aug 2004 09:59:01 +0900 + +libapache2-mod-fcgid (0.77-1) unstable; urgency=low + + * Initial Release. + + -- Tatsuki Sugiura Wed, 21 Jul 2004 06:38:33 +0900 + --- libapache2-mod-fcgid-2.1.orig/debian/compat +++ libapache2-mod-fcgid-2.1/debian/compat @@ -0,0 +1 @@ +4 --- libapache2-mod-fcgid-2.1.orig/debian/fcgid.conf +++ libapache2-mod-fcgid-2.1/debian/fcgid.conf @@ -0,0 +1,6 @@ + + AddHandler fcgid-script .fcgi + SocketPath /var/lib/apache2/fcgid/sock + SharememPath /var/lib/apache2/fcgid/shm + IPCConnectTimeout 20 + --- libapache2-mod-fcgid-2.1.orig/debian/fcgid.load +++ libapache2-mod-fcgid-2.1/debian/fcgid.load @@ -0,0 +1 @@ +LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so --- libapache2-mod-fcgid-2.1.orig/debian/libapache2-mod-fcgid.postinst +++ libapache2-mod-fcgid-2.1/debian/libapache2-mod-fcgid.postinst @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +case "$1" in + configure) + test ! -e /etc/apache2/mods-enabled/fastcgi.load \ + -a ! -e /etc/apache2/mods-enabled/fcgid.load \ + && /usr/sbin/a2enmod fcgid + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 --- libapache2-mod-fcgid-2.1.orig/debian/README.Debian +++ libapache2-mod-fcgid-2.1/debian/README.Debian @@ -0,0 +1,10 @@ +libapache2-mod-fcgid for Debian +------------------------------ + + On Debian System, just put a file has .fcgi suffix in directory with ExecCGI, + and you can run the scripts as FastCGI. + + If you need more information, visit website of upstream author; + http://fastcgi.coremail.cn/ + + -- Tatsuki Sugiura , Wed, 21 Jul 2004 06:38:33 +0900 --- libapache2-mod-fcgid-2.1.orig/debian/configuration.htm +++ libapache2-mod-fcgid-2.1/debian/configuration.htm @@ -0,0 +1,111 @@ + + + + + + +The mod_fcgid Home Page + + + + +

This is a for regular fastcgi. 

LoadModule fcgid_module +modules/mod_fcgid.so

+<Location /fcgid>
+    SetHandler fcgid-script
+    Options ExecCGI
+    allow from all
+</Location>

+  +


+

This is for suEXEC. Please get more information about suEXEC here

LoadModule fcgid_module +modules/mod_fcgid.so

+<Location /fcgid>
+    SetHandler fcgid-script
+    Options ExecCGI
+    allow from all
+</Location>

+<VirtualHost 192.168.1.89>
+    ServerAdmin webmaster@host.foo.com
+
    DocumentRoot /usr/local/apache2/htdocs/
+    ServerName host.foo.com
+    SuexecUserGroup pqf pqf
+</VirtualHost>

+  +


+

This is for fastcgi-mode PHP (UNIX)

LoadModule fcgid_module modules/mod_fcgid.so

+<Directory /usr/local/apache2/htdocs/php>
+    SetHandler fcgid-script
+    FCGIWrapper /usr/local/bin/php .php
+    Options ExecCGI
+    allow from all
+</Directory>

This works too:

LoadModule fcgid_module +modules/mod_fcgid.so 

+AddHandler fcgid-script .php
+<Directory /usr/local/apache2/htdocs/php>
+    FCGIWrapper /usr/local/bin/php .php
+    Options ExecCGI
+    allow from all
+</Directory>

# Please make sure:
+# php is configured with --enable-fastcgi option
+# check error_log(with debug level), if +any thing goes wrong
+


+

This is for suPHP  ( UNIX ) +

LoadModule fcgid_module modules/mod_fcgid.so
+
+<VirtualHost *:80>
+    ServerName test2.example.com
+    DocumentRoot /usr/local/apache2/htdocs/test2.example.com/
+    SuexecUserGroup pqf pqf
+</VirtualHost>
+
+<Directory /usr/local/apache2/htdocs/test2.example.com/>
+    AddHandler fcgid-script .php
+    Options ExecCGI
+    allow from all
+    FCGIWrapper /usr/local/apache2/htdocs/test2.example.com/php .php
+</Directory>

+

+ +# Please make sure:
+# php is configured with --enable-fastcgi option
+# copy php execution to /usr/local/apache2/htdocs/test2.example.com/ directory
+# make sure all files in /usr/local/apache2/htdocs/test2.example.com/ with right +owner and group
+# check error_log(with debug level) and suexec_log, if +any thing goes wrong
+
+ +


+


+This is for fastcgi-mode PHP ( Windows )

LoadModule fcgid_module modules/mod_fcgid.so

+<Directory "C:/Apache2/htdocs/php/">
+    SetHandler fcgid-script
+    Options execCGI
+    AllowOverride None
+    Order allow,deny
+    Allow from all
+    FCGIWrapper "c:/php/php.exe" .php
+</Directory>

This works too:

LoadModule fcgid_module modules/mod_fcgid.so 

+AddHandler fcgid-script .php
+<Directory "C:/Apache2/htdocs/php/">
+    FCGIWrapper "c:/php/php.exe" .php
+    Options ExecCGI
+    allow from all
+</Directory>
+ +


+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+ + + + --- libapache2-mod-fcgid-2.1.orig/debian/copyright +++ libapache2-mod-fcgid-2.1/debian/copyright @@ -0,0 +1,9 @@ +This package was debianized by Tatsuki Sugiura on +Wed, 21 Jul 2004 06:38:33 +0900. + +It was downloaded from http://fastcgi.coremail.cn/ + +Upstream Author: Pan qingfeng + +Copyright: GPL +details for /usr/share/common-licenses/GPL --- libapache2-mod-fcgid-2.1.orig/mod_fcgid.c +++ libapache2-mod-fcgid-2.1/mod_fcgid.c @@ -523,6 +523,8 @@ AP_INIT_TAKE1("BusyScanInterval", set_busy_scan_interval, NULL, RSRC_CONF, "scan interval for busy timeout process"), + AP_INIT_TAKE1("ShutdownTimeout", set_shutdown_timeout, NULL, RSRC_CONF, + "a fastcgi application requested exit will be killed forcely after ShutdownTimeout"), AP_INIT_TAKE1("ErrorScanInterval", set_error_scan_interval, NULL, RSRC_CONF, "scan interval for exited process"),