From: Jeff Trawick Date: Fri, 20 Jun 2003 22:53:15 +0000 (+0000) Subject: mod_cgid: Eliminate a double-close of a socket. This resolves X-Git-Tag: pre_ajp_proxy~1522 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a371fa684666cede178d962e2e3347445df9869;p=apache mod_cgid: Eliminate a double-close of a socket. This resolves various operational problems in a threaded MPM, since on the second attempt to close the socket, the same descriptor was often already in use by another thread for another purpose. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100320 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index e2509e32fd..66f8234d25 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,12 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_cgid: Eliminate a double-close of a socket. This resolves + various operational problems in a threaded MPM, since on the + second attempt to close the socket, the same descriptor was + often already in use by another thread for another purpose. + [Jeff Trawick] + *) Unix: Handle permissions settings for flock-based mutexes in unixd_set_global|proc_mutex_perms(). Allow the functions to be called for any type of mutex. PR 20312 [Jeff Trawick] diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 34be91ee7b..44845ff51a 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -1189,22 +1189,21 @@ static apr_status_t cleanup_script(void *vptr) return APR_EGENERAL; } + /* we got a socket, and there is already a cleanup registered for it */ + req.req_type = GETPID_REQ; req.conn_id = info->r->connection->id; stat = sock_write(sd, &req, sizeof(req)); if (stat != APR_SUCCESS) { - close(sd); return stat; } /* wait for pid of script */ stat = sock_read(sd, &pid, sizeof(pid)); if (stat != APR_SUCCESS) { - close(sd); return stat; } - close(sd); if (pid == 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, info->r,