fcgid_pm_main.c

Checkout Tools
  • last updated 4 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Follow up to r1604123: make it compile.

Lower log "graceful kill fail, sending SIGKILL" level to DEBUG on Windows.

PR 54597.

Submitted by: Mario Brandt <JBlond gmail.com>

Reviewed by: gsmith

Revert r1377398 (bug fix for PR 53693), which results

in more processes being used. This needs more careful

analysis and modification before release.

Also revert r1397778 (PR 54000) and r1527358, which addressed issues

with r1377398.

  1. … 5 more files in changeset.
New protocol to avoid too much sleep, improve performance while stress testing

1. procmgr_send_spawn_cmd() now return a status code from PM, so process handler now know the spawn request is denyed or not.

2. if a new process is created, no sleep is needed.

3. if no process is created, sleep a while

PR: 53693

Submitted by: Ryan Pan <panqingfeng gmail>

  1. … 4 more files in changeset.
Modify function names for a better understanding

1. procmgr_post_spawn_cmd -> procmgr_send_spawn_cmd

2. procmgr_peek_cmd -> procmgr_fetch_cmd

  1. … 4 more files in changeset.
Resolve crash during graceful restarts.

PR: 50309

Submitted by: Mario Brandt <JBlond gmail.com>

  1. … 1 more file in changeset.
Cleanup effort in prep for GA push:

Trim trailing whitespace... no func change

  1. … 9 more files in changeset.
follow up r1028683 with another fix for mod_vhost_ldap

that creates per-request r->server->module_config, so

we can't send that ptr over to the daemon; instead,

copy out the one thing we need

Suggested by: Anders Kaseorg <andersk mit.edu>

  1. … 4 more files in changeset.
Allow FastCGI apps more time to exit at shutdown before being

forcefully killed.

The main changes in behavior are

* if app doesn't go away at first graceful shutdown, try again

after t0 + 1 second

* wait until t0 + 8 seconds before forceful shutdown

Previously it tried graceful shutdown, waited one second, then

did forceful shutdown for any apps still alive.

  1. … 1 more file in changeset.
follow up r1028551 with an additional fix in support

of modules which create server_rec dynamically

in this case, server_rec was used in the fcgid daemon

to obtain the vhost config for a process being started

and for logging the ServerName setting for a process

  1. … 4 more files in changeset.
follow up r939472 with a more complex fix which

should work with mass vhost modules that make copies

of server_rec so they can modify some of those

settings on a per-request basis

  1. … 6 more files in changeset.
Fix the search for processes with the proper vhost config when

ServerName isn't set in every vhost or a module updates

r->server->server_hostname dynamically (e.g., mod_vhost_cdb).

In r753578, the check for vhost was added to searches for available

processes so that only processes with the same configuration would

be found.

(In what seems like a separate issue, it was also added to the

search for the count of matching processes (spawn control).)

The check was implemented by saving r->server->server_hostname

and comparing that value. This fails in the following cases:

a) ServerName hasn't been configured in each vhost

b) some module updates r->server->server_hostname dynamically

(mod_vhost_cdb is one such module)

Change the implementation to just use the server_rec. This should

be sufficient for distinguishing potentially different vhost

configs, and it provides addressibility to server->server_hostname

for logging as well.

  1. … 8 more files in changeset.
clean up declarations of buffers for cmdline and executable paths

- now there are separate fcgid-specific constants for those limits

- cmdline limit is now larger than executable path limit

use sizeof(target buffer) as third param to apr_cpystrn instead of

expected size of the buffer, to help avoid future defects

add checks for truncated paths/cmdlines in order to generate a

more helpful error message

  1. … 9 more files in changeset.
add a debug log of the number of processes being terminated

gracefully on the current error scan

Fix lookup of process command lines when using FcgidWrapper or

access control directives, including within .htaccess files.

Making the existing command-line-to-group-ID mapping work with dynamically

discovered configurations (i.e., .htaccess files) and making it thread-safe

would require global shared-memory storage with locks, or something similar.

Instead we just use the raw command lines to help distinguish different

processes.

Also clean up some interactions between access control directives and

wrappers, specifically, since AAA directives perform a check for an

extant (executable) file based on the path they're configured with,

they can only work with wrappers if the wrapper is an actual file, not

a virtual one, and thus we can remove the additional get_wrapper_info() calls

for these directives. Effectively, the AAA directives are themselves a

kind of wrapper, since we're not looking up their process from the requested

URL. Future work might allow the AAA directives to take a command line

with arguments, making them equal citizens with non-AAA wrappers.

  1. … 11 more files in changeset.
Bug fix, Bug 47873 - unreliable coordination between daemon and request thread for BusyTimeout processing

New protocol is:

1. Process node's diewhy init with FCGID_DIE_KILLSELF

2. Process manager set diewhy to FCGID_DIE_BUSY_TIMEOUT and gracefully kill process while busy timeout

3. Process manager forced kill process while busy timeout and diewhy is FCGID_DIE_BUSY_TIMEOUT

4. Request handler move process node to error list if node's diewhy is FCGID_DIE_BUSY_TIMEOUT

  1. … 1 more file in changeset.
Add fcgid extension to mod_status

  1. … 4 more files in changeset.
axe unnecessary apr_time_now() call, hinted at indirectly by LLVM scan-build

axe set-but-unused variable noticed by LLVM scan-build

separate [un]locking of the process table by the PM and

the request handling threads for better logging

(and potentially context-appropriate error handling in

the future)

  1. … 4 more files in changeset.
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.

  1. … 6 more files in changeset.
s/wrapperpath/wrapper_cmdline/

The use of the "wrapperpath" field/variable changed in the past to include

any optional arguments to the wrapper command. Rename accordingly.

  1. … 5 more files in changeset.
Allow/respect virtual host settings for the following directives:

FCGIDBusyTimeout, FCGIDDefaultMaxClassProcessCount,

FCGIDDefaultMinClassProcessCount, FCGIDIdleTimeout, and

FCGIDProcessLifetime.

Prior to r815897 they were allowed in a virtual host but ignored

since the PM had no way to see them. Now a fcgid_cmd_options

structure with this information is passed to the PM. (Existing

initial env settings, already passed to the PM, now reside in

this structure too.)

  1. … 11 more files in changeset.
- Fix indentation and add an XXX comment about strange logging

- Improve code readability by changing line breaks

  1. … 1 more file in changeset.
Termination of idle processes after inactivity timeout can now be

disabled by setting FCGIDIdleTimeout to 0. Termination of idle

processes based on the process lifetime can now be disabled by setting

FCGIDProcessLifeTime to 0. FCGIDMaxRequestsPerProcess now accepts 0

for unlimited.

Submitted by: Ricardo Cantu <ricardo smartcsc.com>

Reviewed by: trawick

  1. … 4 more files in changeset.
BusyTimeout can only have a single (global) setting, or the

current BusyTimeout processing* fails. Don't allow BusyTimeout

to have a different value inside a virtual host.

*This current processing is not completely reliable even when

the request thread and the daemon think BusyTimeout has the

same value. I opened BZ #47873 to describe the issue, and I

referred to that bug report in the several related sections

of code.

  1. … 5 more files in changeset.
obtain configuration values from the server config instead

of calling accessor functions and storing the result in

global variables

  1. … 11 more files in changeset.
fix some problems with the apr_status_t parameter to ap_log_XXX

  1. … 5 more files in changeset.
With default_proc_env moved to fcgid_pm_main, it may become static again
Moving CORE_PRIVATE to fcgid_pm_main changes our header requirements
  1. … 1 more file in changeset.