So you propose an inversion here?  Won't that break as many modules making
the (currently) correct assumptions, w.r.t. config data?

Logs are created *from* values in the configuration, ergo they should go away
*before* the values that created them are also destroyed.

E.g., if my module creates a log file, and points at the name of that log, then
the name of that log cannot become invalid before that log file is destroyed
and cleared.

Bill

At 11:53 PM 12/10/2003, Bill Stoddard wrote:
>Check out this PR:
>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20462
>
>plog is created after pconf which means that plog will be cleaned up before pconf 
>during destroy_and_exit_process() called during shutdown. It is not uncommon for 
>modules to register cleanups against pconf and log messages during these cleanups. 
>Since plog has already been cleaned up, nasty things can happen. But...
>
>some of the nastiness reported in the PR may come from improper use of cleanups. If a 
>single module registers multiple cleanups against pconf and those cleanups have 
>dependencies on each other, well, you reap what you sow.
>
>Comments b4 I commit this to 2.1?
>
>Index: include/httpd.h
>===================================================================
>RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
>retrieving revision 1.191.2.7
>diff -u -r1.191.2.7 httpd.h
>--- include/httpd.h     24 Nov 2003 16:07:52 -0000      1.191.2.7
>+++ include/httpd.h     11 Dec 2003 05:40:12 -0000
>@@ -704,6 +704,8 @@
>     const char * const *argv;
>     /** The program name used to execute the program */
>     const char *short_name;
>+    /** Logging pool. Cleared after each config read */
>+    apr_pool_t *plog;
> };
>
> /** A structure that represents the current request */
>Index: server/main.c
>===================================================================
>RCS file: /home/cvs/httpd-2.0/server/main.c,v
>retrieving revision 1.140.2.3
>diff -u -r1.140.2.3 main.c
>--- server/main.c       27 Feb 2003 12:09:44 -0000      1.140.2.3
>+++ server/main.c       11 Dec 2003 05:40:14 -0000
>@@ -276,6 +276,12 @@
>
>     process = apr_palloc(cntx, sizeof(process_rec));
>     process->pool = cntx;
>+    /* The plog pool needs to hang around until the very end because
>+     * modules may be logging messages in cleanups registered against
>+     * pconf.
>+     */
>+    apr_pool_create(&process->plog, process->pool);
>+    apr_pool_tag(process->plog, "plog");
>
>     apr_pool_create(&process->pconf, process->pool);
>     apr_pool_tag(process->pconf, "pconf");
>@@ -428,6 +434,8 @@
>     process = create_process(argc, argv);
>     pglobal = process->pool;
>     pconf = process->pconf;
>+    plog = process->plog;
>+
>     ap_server_argv0 = process->short_name;
>
> #if APR_CHARSET_EBCDIC
>@@ -556,8 +564,7 @@
>         usage(process);
>     }
>
>-    apr_pool_create(&plog, pglobal);
>-    apr_pool_tag(plog, "plog");
>+
>     apr_pool_create(&ptemp, pconf);
>     apr_pool_tag(ptemp, "ptemp");
>
>


Reply via email to