The following reply was made to PR mod_rewrite/3874; it has been noted by GNATS.

From: "Ralf S. Engelschall" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc:  Subject: Re: mod_rewrite/3874: RewriteLock doesn't work for virtual hosts 
and silently fails
Date: Wed, 10 Mar 1999 13:54:57 +0100

 In article <[EMAIL PROTECTED]> you wrote:
 
 >[...]
 > 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.
 
 You're right that there might be a problem caused by the fact that the
 filedescriptor isn't merged into virtual host.  But your solution (moving the
 rewritelock_open call to the init_module function) is incorrect, because this
 doesn't work on platforms where flock() is used.  Because under flock() based
 locking the file _has_ to be opened by the child. So the only solution seems
 to be to interate in init_child() over the virtual hosts.  I'll look at
 this...
                                        Ralf S. Engelschall
                                        [EMAIL PROTECTED]
                                        www.engelschall.com

Reply via email to