Re: [SMARTY] conflated cache during crawl
| From: | messju mohr | Date: | Tue, 09 Mar 2004 10:58:20 +0000 |
| Subject: | Re: [SMARTY] conflated cache during crawl | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11082@lists.php.net to get a copy of this message | ||
On Mon, Mar 08, 2004 at 11:54:48AM -0500, Daniel Cummings wrote:
> Hi List,
>
> I have noticed a strange behavior with caching while trying to crawl my
> smartified site with wget.
>
> If I request pages while the crawl is in progress it corrupts the cache.
> Meaning, the cache for my manually requested page contains bits of data from
> the site that is currently being crawled.
>
> It seems as if there might be a global variable collision somewhere. I am
> using $smarty.server and $smarty.get variables in templates and I suspect
> that there may be some problem with that. But, as I understand it, a new
> smarty object is created for each request and each object should have its
> own copy of those superglobals.
>
> I wonder if anyone has seen "conflated" caches before? Or if you can point
> me to where I can try to debug this.
I haven't seen this, but maybe the generation of the unqiue
temp-filename in libs/core/core.write_file.php is not unique engough.
smarty writes the contents of a file to a temporary file. when done
with writing it closes the file and renames it to correct
filename. this should avoid, that other processes try to use a
half-written file. they get it full (the renamed one) or don't get it
at all.
maybe 2 processes write to the same temp-file.
if you can reproduce this behaviour, please try this:
there is a line in smarty/libs/core/core.write_file.php:
$_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('');
change that to
$_tmp_file = tempnam($_dirname , '_tmp');
and rerun you test, and look if the problem remains.
another one to try would be:
$_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('', true);
It would be great if you can test that and tell us if it is of any
help. BTW: what Operating do you run that site on, and do you run a
multithreaded webserver?
greetings
messju
> php 4.3.2
> smarty 2.6.0
>
> Thanks,
> dan