Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

unlink fails

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Mon Nov 23, 2009 9:47 pm    Post subject: unlink fails Reply with quote

Two warnings my site has spit out on ß4

WARNING [2] unlink(/public/projects/etree/projects/dev.etreedb.org/cache/1498912485.freetext.tpl.php) [function.unlink]: No such file or directory

Warning on line 39 in file /public/projects/etree/projects/dev.etreedb.org/Smarty3Dev/distribution/libs/sysplugins/smarty_internal_write_file.php


WARNING [2] unlink(/public/projects/etree/projects/dev.etreedb.org/cache/1502255914.index.ihtml.php) [function.unlink]: No such file or directory

Warning on line 39 in file /public/projects/etree/projects/dev.etreedb.org/Smarty3Dev/distribution/libs/sysplugins/smarty_internal_write_file.php


The smarty code:
// remove original file
if (file_exists($_filepath))
unlink($_filepath);

It looks like one cache is being written after another deletes it. I get about 200-300k hits / day.
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Nov 23, 2009 10:11 pm    Post subject: Reply with quote

You are entering a race condition, the item is removed between the checks. We could use @unlink() as a means to suppress the error in PHP.

Can you alter unlink() to @unlink() and see if that masks the warning?
Back to top
View user's profile Send private message Visit poster's website
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Mon Nov 23, 2009 10:17 pm    Post subject: Reply with quote

I've changed the code. I'll report back in a few days whether I see any more warnings.
Back to top
View user's profile Send private message Visit poster's website
angelndevils
Smarty n00b


Joined: 21 Oct 2010
Posts: 1

PostPosted: Thu Oct 21, 2010 7:12 am    Post subject: Reply with quote

I have same problem. Everything is ok until I reinstall apache and php... I don't know what happening? Sad Sad Sad
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP