Hi,

revision 1162854 fixes

  https://issues.apache.org/bugzilla/show_bug.cgi?id=45076

but introduces a very similar bug.

Modperl allows to write modules in Perl. Those modules can also register 
hooks. The earliest point in time when that may happen is in 
ap_process_config_tree() because there are config statements that 
influence certain parameters of the perl interpreter. So, we have to 
process those statements prior to starting the interpreter. But only the 
perl interpreter knows which modules to load. Those modules then can 
install hooks. But with revision 1162854 these hooks are called out of 
order.

With the enclosed patch apr_hook_sort_all() is called once before 
ap_run_pre_config() and then again after ap_process_config_tree().

The patch applies to 2.2.21 but the same change was made to trunk as 
well. So, please apply it there too.

I'll reopen bug 45076.

Thanks,
Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
--- server/main.c.orig	2011-10-07 19:18:13.395926482 +0200
+++ server/main.c	2011-10-07 19:25:18.985699364 +0200
@@ -633,6 +633,8 @@
     if (!server_conf) {
         destroy_and_exit_process(process, 1);
     }
+    /* sort hooks here to make sure pre_config hooks are sorted properly
+     */
     apr_hook_sort_all();
 
     if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
@@ -646,6 +648,10 @@
     if (rv == OK) {
         ap_fixup_virtual_hosts(pconf, server_conf);
         ap_fini_vhost_config(pconf, server_conf);
+        /* sort hooks again b/c ap_process_config_tree might add modules and
+         * hence hooks.
+         */
+        apr_hook_sort_all();
 
         if (configtestonly) {
             ap_run_test_config(pconf, server_conf);
@@ -704,6 +710,8 @@
         if (!server_conf) {
             destroy_and_exit_process(process, 1);
         }
+        /* sort hooks here to make sure pre_config hooks are sorted properly
+         */
         apr_hook_sort_all();
 
         if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
@@ -718,6 +726,10 @@
         }
         ap_fixup_virtual_hosts(pconf, server_conf);
         ap_fini_vhost_config(pconf, server_conf);
+        /* sort hooks again b/c ap_process_config_tree might add modules and
+         * hence hooks.
+         */
+        apr_hook_sort_all();
         apr_pool_clear(plog);
         if (ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
             ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,

Reply via email to