[Templates] Templates Cached to Disk

Tom Gioconda achronos@bungie.com
Fri, 15 Mar 2002 11:12:23 -0800


Okay, apparently I was wrong about that virus checker bug locking my
cache files.  What actually is happening is that
Provider::_load_compiled() is returning 1 for the templates.  Basically,
when it does "$compiled = require $file", $compiled gets the value 1 on
occasion.  There doesn't seem to be a pattern on which templates get
this error, either.  I checked %INC, too, just in case the delete
operator was doing what it was supposed to.  %INC didn't have the file
being loaded in it, as expected. 

Well, I'm completely at a loss here.  This only happens on one of my
virtual sites, the other one (which runs essentially the same code for
its handler) doesn't get this problem.  It also should be noted that I'm
running on IIS 5 here, on Windows. yeah, I know, but its datacenter
policy.  Another interesting thing is that the error doesn't occur if
the script is run outside of IIS.  I'm getting real close here to
sacking _load_compiled and writing my own that doesn't use require but
loads the file itself and then evals the contents of it (and not having
to worry about %INC).  I don't want to have to the trouble, but this is
getting irritating.

-Tom

-------------------------------
Tom Gioconda wrote:
> I'm having a problem with some templates on my site returning "invalid

> template reference: 1" a lot.

Hmmm.  Did that race condition with writing cache files get fixed? 
Which version are you running?  Are you writing to NFS?

 > Shouldn't the Template
> Toolkit attempt to load from the original source template if its cache

> load fails, either in memory or from a disk file?

It attempts to load from the original if a cache file is not found, but 
the code currently assumes that cache files will always be good and that

a failure in them indicates that something really bad is wrong.  You 
could change that pretty easilly, but the problem you're experiencing is

definitely not normal behavior.

- Perrin