mod_fastcgi: Fix host->active_procs counter, return 503 if connect wasn't successful after 5 tries (fixes #1825)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2657 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Stefan Bühler 14 years ago
parent 1aaa67bb9b
commit 19838e99eb

@ -56,6 +56,7 @@ NEWS
* mod_rewrite: add url.rewrite-[repeat-]if-not-file to rewrite if file doesn't exist or is not a regular file (fixes #985, thx lucas aerbeydt)
* Add TLS servername indication (SNI) support (fixes #386, thx Peter Colberg <peter@colberg.org>)
* Add SSL Client Certificate verification (#1288)
* mod_fastcgi: Fix host->active_procs counter, return 503 if connect wasn't successful after 5 tries (fixes #1825)
- 1.4.23 - 2009-06-19
* Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)

@ -125,7 +125,7 @@ typedef struct {
unsigned short max_procs;
size_t num_procs; /* how many procs are started */
size_t active_procs; /* how many of them are really running */
size_t active_procs; /* how many of them are really running, i.e. state = PROC_STATE_RUNNING */
/*
* time after a disabled remote connection is tried to be re-enabled
@ -447,6 +447,7 @@ static void fcgi_host_disable(server *srv, handler_ctx *hctx) {
plugin_data *p = hctx->plugin_data;
if (hctx->host->disable_time || hctx->proc->is_local) {
if (hctx->proc->state == PROC_STATE_RUNNING) hctx->host->active_procs--;
hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
hctx->proc->state = hctx->proc->is_local ? PROC_STATE_DIED_WAIT_FOR_PID : PROC_STATE_DIED;
@ -3007,6 +3008,7 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) {
"load:", host->load);
hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
if (hctx->proc->state == PROC_STATE_RUNNING) hctx->host->active_procs--;
hctx->proc->state = PROC_STATE_OVERLOADED;
}
@ -3230,8 +3232,6 @@ SUBREQUEST_FUNC(mod_fastcgi_handle_subrequest) {
if (hctx->state == FCGI_STATE_INIT ||
hctx->state == FCGI_STATE_CONNECT_DELAYED) {
if (proc) host->active_procs--;
fcgi_restart_dead_procs(srv, p, host);
/* cleanup this request and let the request handler start this request again */
@ -3245,7 +3245,7 @@ SUBREQUEST_FUNC(mod_fastcgi_handle_subrequest) {
buffer_reset(con->physical.path);
con->mode = DIRECT;
con->http_status = 500;
con->http_status = 503;
joblist_append(srv, con); /* in case we come from the event-handler */
return HANDLER_FINISHED;
@ -3861,6 +3861,7 @@ TRIGGER_FUNC(mod_fastcgi_handle_trigger) {
status);
}
proc->pid = 0;
if (proc->state == PROC_STATE_RUNNING) host->active_procs--;
proc->state = PROC_STATE_UNSET;
host->max_id--;
}

Loading…
Cancel
Save