Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 82713 invoked from network); 25 Oct 2009 19:07:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Oct 2009 19:07:07 -0000 Received: (qmail 38856 invoked by uid 500); 25 Oct 2009 19:07:07 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 38790 invoked by uid 500); 25 Oct 2009 19:07:07 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 38756 invoked by uid 99); 25 Oct 2009 19:07:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Oct 2009 19:07:04 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Oct 2009 19:07:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B929623888CE; Sun, 25 Oct 2009 19:06:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r829631 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID modules/fcgid/fcgid_conf.c modules/fcgid/fcgid_conf.h modules/fcgid/fcgid_pm.h modules/fcgid/fcgid_pm_main.c modules/fcgid/fcgid_pm_unix.c modules/fcgid/fcgid_pm_win.c Date: Sun, 25 Oct 2009 19:06:41 -0000 To: cvs@httpd.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091025190641.B929623888CE@eris.apache.org> Author: trawick Date: Sun Oct 25 19:06:41 2009 New Revision: 829631 URL: http://svn.apache.org/viewvc?rev=829631&view=rev Log: Segregate environment variable settings from other processing options sent to the process manager to keep the (currently) huge environment variable information out of shared memory. 2.3.4 failed startup on OS X with its default 4MB shared memory limit; 2.2 didn't have this problem. Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original) +++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Sun Oct 25 19:06:41 2009 @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with mod_fcgid 2.3.5 + *) Fix startup errors creating shared memory in constrained systems, such + as OS X in its default configuration. This is a regression since mod_fcgid + 2.2. [Jeff Trawick] + *) Recover from most "Resource temporarily unavailable" errors writing the request to the FastCGI application. These were common with large request bodies on Mac OS X and intermittent on Solaris. PR 48025. [Jeff Trawick] Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Sun Oct 25 19:06:41 2009 @@ -870,7 +870,7 @@ return NULL; } -static int set_cmd_envvars(fcgid_cmd_options *cmdopts, apr_table_t *envvars) +static int set_cmd_envvars(fcgid_cmd_env *cmdenv, apr_table_t *envvars) { const apr_array_header_t *envvars_arr; const apr_table_entry_t *envvars_entry; @@ -888,17 +888,17 @@ if (envvars_entry[i].key == NULL || envvars_entry[i].key[0] == '\0') break; - apr_cpystrn(cmdopts->initenv_key[i], envvars_entry[i].key, + apr_cpystrn(cmdenv->initenv_key[i], envvars_entry[i].key, INITENV_KEY_LEN); - apr_cpystrn(cmdopts->initenv_val[i], envvars_entry[i].val, + apr_cpystrn(cmdenv->initenv_val[i], envvars_entry[i].val, INITENV_VAL_LEN); } if (i < INITENV_CNT) { - cmdopts->initenv_key[i][0] = '\0'; + cmdenv->initenv_key[i][0] = '\0'; } } else { - cmdopts->initenv_key[0][0] = '\0'; + cmdenv->initenv_key[0][0] = '\0'; } return overflow; @@ -917,6 +917,7 @@ apr_status_t rv; cmdopts = apr_pcalloc(cmd->pool, sizeof *cmdopts); + cmdopts->cmdenv = apr_pcalloc(cmd->pool, sizeof *cmdopts->cmdenv); cmdopts->busy_timeout = DEFAULT_BUSY_TIMEOUT; cmdopts->idle_timeout = DEFAULT_IDLE_TIMEOUT; @@ -1041,7 +1042,7 @@ option); } - if ((overflow = set_cmd_envvars(cmdopts, envvars)) != 0) { + if ((overflow = set_cmd_envvars(cmdopts->cmdenv, envvars)) != 0) { return apr_psprintf(cmd->pool, "mod_fcgid: environment variable table " "overflow; increase INITENV_CNT in fcgid_pm.h from" " %d to at least %d", @@ -1054,7 +1055,8 @@ } void get_cmd_options(request_rec *r, const char *cmdpath, - fcgid_cmd_options *cmdopts) + fcgid_cmd_options *cmdopts, + fcgid_cmd_env *cmdenv) { fcgid_server_conf *sconf = ap_get_module_config(r->server->module_config, &fcgid_module); @@ -1065,6 +1067,8 @@ if (cmd_specific) { /* ignore request context configuration */ *cmdopts = *cmd_specific; + *cmdenv = *cmdopts->cmdenv; + cmdopts->cmdenv = NULL; /* pick up configuration for values that can't be configured * on FcgidCmdOptions */ @@ -1081,7 +1085,7 @@ cmdopts->min_class_process_count = sconf->min_class_process_count; cmdopts->proc_lifetime = sconf->proc_lifetime; - if ((overflow = set_cmd_envvars(cmdopts, sconf->default_init_env)) != 0) { + if ((overflow = set_cmd_envvars(cmdenv, sconf->default_init_env)) != 0) { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "mod_fcgid: %d environment variables dropped; increase " "INITENV_CNT in fcgid_pm.h from %d to at least %d", @@ -1089,4 +1093,6 @@ INITENV_CNT, INITENV_CNT + overflow); } + + cmdopts->cmdenv = NULL; } Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Sun Oct 25 19:06:41 2009 @@ -129,12 +129,19 @@ } fcgid_dir_conf; /* processing options which are sent to the PM with a spawn request - * and/or configurable via FCGIDCmdOptions + * and/or configurable via FCGIDCmdOptions; envvars are kept in a + * separate structure to keep them out of the process table in order + * to limit shared memory use */ #define INITENV_KEY_LEN 64 #define INITENV_VAL_LEN 128 #define INITENV_CNT 64 typedef struct { + char initenv_key[INITENV_CNT][INITENV_KEY_LEN]; + char initenv_val[INITENV_CNT][INITENV_VAL_LEN]; +} fcgid_cmd_env; + +typedef struct { int busy_timeout; int idle_timeout; int ipc_comm_timeout; @@ -143,8 +150,7 @@ int max_requests_per_process; int min_class_process_count; int proc_lifetime; - char initenv_key[INITENV_CNT][INITENV_KEY_LEN]; - char initenv_val[INITENV_CNT][INITENV_VAL_LEN]; + fcgid_cmd_env *cmdenv; } fcgid_cmd_options; void *create_fcgid_server_config(apr_pool_t * p, server_rec * s); @@ -253,7 +259,7 @@ const char *arg); void get_cmd_options(request_rec *r, const char *cmdpath, - fcgid_cmd_options *cmdopts); + fcgid_cmd_options *cmdopts, fcgid_cmd_env *cmdenv); AP_MODULE_DECLARE_DATA extern module fcgid_module; Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h Sun Oct 25 19:06:41 2009 @@ -30,7 +30,10 @@ uid_t uid; /* For suEXEC */ gid_t gid; /* For suEXEC */ int userdir; /* For suEXEC */ - fcgid_cmd_options cmdopts; /* context-specific configuration */ + fcgid_cmd_options cmdopts; /* context-specific configuration, other than + * envvars + */ + fcgid_cmd_env cmdenv; /* start the command with these env settings */ } fcgid_command; void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r, Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c Sun Oct 25 19:06:41 2009 @@ -524,10 +524,10 @@ */ default_proc_env(procinfo.proc_environ); for (i = 0; i < INITENV_CNT; i++) { - if (command->cmdopts.initenv_key[i][0] == '\0') + if (command->cmdenv.initenv_key[i][0] == '\0') break; - apr_table_set(procinfo.proc_environ, command->cmdopts.initenv_key[i], - command->cmdopts.initenv_val[i]); + apr_table_set(procinfo.proc_environ, command->cmdenv.initenv_key[i], + command->cmdenv.initenv_val[i]); } /* Spawn the process now */ Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Sun Oct 25 19:06:41 2009 @@ -423,7 +423,7 @@ cmd_to_spawn = command->cgipath; } - get_cmd_options(r, cmd_to_spawn, &command->cmdopts); + get_cmd_options(r, cmd_to_spawn, &command->cmdopts, &command->cmdenv); } apr_status_t procmgr_post_spawn_cmd(fcgid_command * command, Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c?rev=829631&r1=829630&r2=829631&view=diff ============================================================================== --- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c (original) +++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Sun Oct 25 19:06:41 2009 @@ -152,7 +152,7 @@ cmd_to_spawn = command->cgipath; } - get_cmd_options(r, cmd_to_spawn, &command->cmdopts); + get_cmd_options(r, cmd_to_spawn, &command->cmdopts, &command->cmdenv); } apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,