#015227: Race condition in ezcCacheStorageFile::lock() causes E_WARNING

Description:

When the lock file gets deleted while ezcCacheStorageFile::lock() waits for the lock, a E_WARNING error gets throwed because it tries to use filemtime() on the lock file (that doesn't exist anymore) to check if the lock is dead.


Warning: filemtime(): stat failed for /tmp/cache/test/.ezcLock in /usr/share/php/ezc/Cache/storage/file.php on line 735

Call Stack:
    0.0004     100696   1. {main}() /home/jou/dev/ezc_cache_race_condition.php:0
    0.0126     802080   2. ezcCacheStorageFile->lock() /home/jou/dev/ezc_cache_race_condition.php:13
    1.0129     802264   3. filemtime() /usr/share/php/ezc/Cache/storage/file.php:735

Warning: unlink(/tmp/cache/test/.ezcLock): No such file or directory in /usr/share/php/ezc/Cache/storage/file.php on line 737

Call Stack:
    0.0004     100696   1. {main}() /home/jou/dev/ezc_cache_race_condition.php:0
    0.0126     802080   2. ezcCacheStorageFile->lock() /home/jou/dev/ezc_cache_race_condition.php:13
    1.0131     802320   3. unlink() /usr/share/php/ezc/Cache/storage/file.php:737

We either need a file_exists() check before calling filemtime() or a shut-up operator infront of the filemtime() and unlink() calls.


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


Steps to Reproduce:

Execute attached test case in two shells in parallel. The process that get started later throws the error.


- Attachments
ezc_cache_race_condition.php (290 b)
[Download] [Permanent Link]
Test Case

- Comments

Fixed in rev. #10766.

#262619 by Tobias Schlitt on August 17th, 2009 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » Cache
Affects 1.4.1 - Cache 1.4.1
Fix Version 2009.2 sprint 2 - eZ components 2009.2 sprint 2
Reporter Jiayong Ou
Responsible Tobias Schlitt
Status 0 Closed
Resolution Fixed
Created July 30th, 2009
Updated August 17th, 2009
Resolved August 17th, 2009
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels