Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite lock file

mod_rewrite lock file missing

         

wilsonc

1:04 am on Oct 18, 2006 (gmt 0)

10+ Year Member



hey people,

I am using mod_rewrite but lock file won't create.... don't know if i am doing anything wrong....

I am using:
Apache-2.2.3
under Linux RedHat 2.4.21-27.0.1.EL

what i did... :
downloaded apache from apache.org
compiled with


./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local --with-zlib-dir=/usr/include --enable-module=rewrite --enable-shared=rewrite

make;make install

/usr/local/apache/bin/apxs -i -c -a /usr/local/httpd-2.2.3/modules/mappers/mod_rewrite.c

then edit httpd.conf


RewriteEngine on
RewriteLock /usr/local/ahl/ahl.lock
RewriteMap ahl prg:/usr/local/ahl/ahl
RewriteCond %{REMOTE_HOST}::%{DOCUMENT_ROOT} (.*)
RewriteRule (.*) ${ahl:\:\:\:\:$1\:\:%1\:\:%{HTTP_REFERER}} [PT]

the directory /usr/local/ahl has permission 777 for testing purposes.
but ahl.lock still dont exist... don't know why..

Anyone please?

Thanks a lot!

Wilson

jdMorgan

1:20 am on Oct 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does your mapping function work, or is there some other indication of a real problem?

The lock file probably won't exist unless a process is actively using the RewriteMap -- It is used a semaphore to force single-threaded use of mapping scripts used by RewriteMap. So, you will probably need to be generating dozens or even hundreds of requests per second that require the RewriteMap function to actually see the file.

Jim

wilsonc

8:35 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



hey sorry for the late reply...
but yeah.. I'm getting 100,000 page loads daily
should be sufficient for the lock file to be created?

jdMorgan

3:13 am on Oct 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That might be only 1.2 RewriteMap accesses per second, so you may need ten times that much traffic to 'catch' the lock file while it exists. It will only exist for a few milliseconds while the locked resource is actually being used by an Apache thread...

Again, do you have a functional problem, or is this just curiosity here? If you want to make sure that the lock file is being created, write a server script to check that file for existence 100 times per second and log the result, and write a client-side script to request the specific resource URLs rewritten by RewriteMap as fast as possible from the server. If you run those two scripts for a few minutes, you should see the lock file winking in and out of existence in the first script's log file. Due to sampling error, it won't show a true 'log' of the file existence, but will give some indication of the activity.

I suppose another alternative is to add code to your RewriteMap script to delay it for 200 milliseconds before it exits -- That would make the lock file exist for a longer period of time, and perhaps you could catch it more easily that way. If you just want proof, then delay your RewriteMap script exit for five seconds -- That'll bring your server to its knees, but you'll likely be able to see the lock file that way, even just doing manual FTP directory-view checks.

Jim