Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 444 invoked by uid 500); 1 Feb 2002 18:00:23 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 431 invoked from network); 1 Feb 2002 18:00:23 -0000 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.0.1 Date: Fri, 01 Feb 2002 11:00:11 -0700 From: "Brad Nicholes" To: Subject: Re: cvs commit: httpd-2.0/server scoreboard.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Why is the platform #ifdef WIN32 being included in an HTTPD source file? I thought the whole idea was to keep platform specific code out of the general HTTPD source and put it in APR. >>> aaron@apache.org Friday, February 01, 2002 10:22:57 AM >>> aaron 02/02/01 09:22:57 Modified: server scoreboard.c Log: Create the scoreboard (in the parent) in a global pool context, so it survives graceful restarts. This fixes a SEGV during graceful restarts. Children who attach to this scoreboard keep the same pool as before (pchild) since they should detach/unmap when the child process exits. Revision Changes Path 1.54 +21 -4 httpd-2.0/server/scoreboard.c Index: scoreboard.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- scoreboard.c 30 Jan 2002 22:35:56 -0000 1.53 +++ scoreboard.c 1 Feb 2002 17:22:57 -0000 1.54 @@ -165,14 +165,27 @@ * a scoreboard shared between processes using any IPC technique, * not just a shared memory segment */ -static apr_status_t open_scoreboard(apr_pool_t *p) +static apr_status_t open_scoreboard(apr_pool_t *pconf) { #if APR_HAS_SHARED_MEMORY apr_status_t rv; char *fname = NULL; + apr_pool_t *global_pool; + + /* We don't want to have to recreate the scoreboard after + * restarts, so we'll create a global pool and never clean it. + */ + rv = apr_pool_create(&global_pool, NULL); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "Fatal error: unable to create global pool " + "for use with by the scoreboard"); + return rv; + } #ifndef WIN32 - rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, p); + rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, + global_pool); if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, "Fatal error: could not create scoreboard " @@ -184,9 +197,13 @@ { #endif if (ap_scoreboard_fname) { - fname = ap_server_root_relative(p, ap_scoreboard_fname); + fname = ap_server_root_relative(global_pool, ap_scoreboard_fname); + /* make sure the file doesn't exist before trying + * to create the segment. */ + apr_file_remove(fname, global_pool); } - rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, p); + rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, + global_pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, "Fatal error: could not open(create) scoreboard");