Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.8.3

Bug #14636 Intermitent bugs during autocleaning and reading
Submitted: 2008-09-11 07:00 UTC
From: tom75 Assigned:
Status: Wont fix Package: Cache_Lite (version 1.7.4)
PHP Version: 5.2.5 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-09-11 07:00 UTC] tom75 (Tom Tom)
Description: ------------ I have sometimes this bug during autocleaning : [warning] [/www/sources/cache_lite/Lite.php (Line 581)] unlink(/www/html/temp/cache_4/cache_48/cache_a7b2dab44b5ee1981fe92e12229db431_142f2ae86596fff5b9754e337519b742) [function.unlink]: No such file or directory Intermitent bug : [warning] [/www/sources/cache_lite/Lite.php (Line 724)] fread() [function.fread]: Length parameter must be greater than 0

Comments

 [2008-09-11 07:13 UTC] tacker (Markus Tacker)
Tom Tom, please provide the relevant code sections of your application.
 [2008-09-11 07:48 UTC] tom75 (Tom Tom)
My conf ------------------------- $options = array( 'cacheDir' => RACINE_DIR.'html/temp/', 'caching'=> true, 'lifeTime' => 120 'automaticSerialization' => true, 'automaticCleaningFactor' => 20, 'hashedDirectoryLevel' => 2 ); $mycache = new Cache_Lite($options); The code ----------------------- foreach ($q as $num => $query) { $cache_id = $this->construct_cache_id($q[$num]['name'], $q[$num]['cache_name_prefix']); if ( $q[$num]['cache'] && $tab_cache = $mycache->get($cache_id, $salon['genre'])) { $ress[$num] = $tab_cache; } else { $ress[$num] = $bd->execRequete($query['req'], 1); } } $bd->quitter();
 [2008-09-11 07:52 UTC] tom75 (Tom Tom)
For the unlink bug, I changed the _unlink method (Lite.php line 579) to : function _unlink($file) { if (is_file($file)) { if (!@unlink($file)) { return $this->raiseError('Cache_Lite : Unable to remove cache !', -3); } } return true; } --- I hope it will resolve the problem
 [2008-09-11 08:03 UTC] tom75 (Tom Tom)
I still got the bugs, here is the complete backtrace : [2008-09-11 Thu 09:56:19] [warning] [/www/sources/cache_lite/Lite.php (Line 727)] fread() [function.fread]: Length parameter must be greater than 0 -------- -> modules->load_boxes() @ sources/class/Module.class.php line 45 ---------- -> Cache_Lite->save() @ sources/class/Module.class.php line 448 ------------ -> Cache_Lite->_writeAndControl() @ sources/cache_lite/Lite.php line 385 -------------- -> Cache_Lite->_read() @ sources/cache_lite/Lite.php line 799 ---------------- -> fread() @ sources/cache_lite/Lite.php line 727 ------------------ -> Error_log->Warning() @ sources/moteur.php line 88 [2008-09-11 Thu 09:57:07] [warning] [/www/sources/cache_lite/Lite.php (Line 583)] unlink(/www/html/temp/cache_c/cache_c2/cache_381035d3e42caf54d7bc7d7242246a10_0930d8458a88b3b7c18d9463ddf38e47) [function.unlink]: No such file or directory -------- -> modules->load_boxes() @ sources/class/Module.class.php line 45 ---------- -> Cache_Lite->save() @ sources/class/Module.class.php line 448 ------------ -> Cache_Lite->clean() @ sources/cache_lite/Lite.php line 381 -------------- -> Cache_Lite->_cleanDir() @ sources/cache_lite/Lite.php line 449 ---------------- -> Cache_Lite->_cleanDir() @ sources/cache_lite/Lite.php line 656 ------------------ -> Cache_Lite->_cleanDir() @ sources/cache_lite/Lite.php line 656 -------------------- -> Cache_Lite->_unlink() @ sources/cache_lite/Lite.php line 632 ---------------------- -> unlink() @ sources/cache_lite/Lite.php line 583 ------------------------ -> Error_log->Warning() @ sources/moteur.php line 88
 [2011-08-27 07:26 UTC] ivonascimento (Ivo Nascimento)
 [2011-08-29 14:54 UTC] tacker (Markus Tacker)
-Status: Open +Status: Wont fix
The problem is, that the cleanup process is not threadsafe meaning, that even after checking that the cache file exists before deleting, another thread could have deleted the file in the meantime. So there is no *easy* fix for the problem with a file based cache system like Cache_Lite.