On Monday 01:33 PM 8/18/2008, Tom Jackson wrote:
It's not be a data corruption issue
because you are choosing to overwrite the old data with new data using
the exact same file name. If the data is important, don't overwrite it,
thus no corruption.

No, you've misunderstood the scenario. The file name needn't be the same to trigger this issue, and the "corruption" doesn't come from serving data out of a file that's changing, but rather because fastpath caching mistakenly identifies a new file as being identical to a previously-cached file (for the reasons I outlined) and erroneously serves the previously-cached data to the user.

This is a design limitation and arguably a bug in the fastpath caching implementation, which is potentially quite serious since it silently serves the wrong data to the user. If you want a more straightforward (albeit contrived) demonstration of the problem, here you go:

   set file [open "/var/tmp/myfile" "w"]
   puts $file "ABC123"
   close $file
   ns_returnfile 200 text/plain "/var/tmp/myfile"
   ns_unlink -nocomplain "/var/tmp/myfile"

   set file [open "/var/tmp/myotherfile" "w"]
   puts $file "XYZ987"
   close $file
   ns_returnfile 200 text/plain "/var/tmp/myotherfile"
   ns_unlink -nocomplain "/var/tmp/myotherfile"

Assuming that /var/tmp/myfile and /var/tmp/myotherfile are created within the same second, the fastpath caching algorithm will misidentify them as the same file, and ns_returnfile will therefore erroneously return the (previously cached) contents of /var/tmp/myfile when it should be returning the (uncached) contents of /var/tmp/myotherfile.

- John


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to