You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Jeff Lewis <le...@stanford.edu> on 1999/02/10 22:25:37 UTC

mod_rewrite/3874: RewriteLock doesn't work for virtual hosts and silently fails

>Number:         3874
>Category:       mod_rewrite
>Synopsis:       RewriteLock doesn't work for virtual hosts and silently fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Feb 10 13:30:02 PST 1999
>Last-Modified:
>Originator:     lewis@stanford.edu
>Organization:
apache
>Release:        1.3.3
>Environment:
SunOS wdev 5.5.1 Generic_103640-14 sun4u sparc SUNW,Ultra-1
gcc version 2.8.1
>Description:
The lock file is opened during the init_child() phase and the file pointer is
saved in that server_rec, but that config info isn't propagated to the virtual 
host config.  Since the file pointer isn't available, even though locking is 
turned on, no locking is done and no warning is given and things break.
>How-To-Repeat:
Add a logging line to rewritelock_alloc() like

    if (conf->rewritelockfp != -1) {
        fd_lock(r, conf->rewritelockfp);
    } else if (conf->rewritelockfile) {
      ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, r,
                   "mod_rewrite: Don't have lockfile descriptor, can't lock");
    }

then use RewriteLock and RewriteMap inside and outside of a virtual host
and you'll see that the lockfile fp isn't available through the virtual
host config, so no locking is done.
>Fix:
I moved the
        rewritelock_open(s, p);
call from the init_child() function to the server for loop in 
init_module() where the rewritelog open is as well, and that seems
to have fixed it.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]