[eluser]Francois Gelinas[/eluser]
This is a small bug in codeigniter/common.php in function is_really_writable($file) that caused some request to the server to fail when there were many requests at the same time.
The problem occurred on my windows vista development station, with apache 2.2 and php 5 and might be caused by the behavior of chmod and unlink under windows.
When a request failed, a line was added to the log pointing to either the @chmod function of the @unlink function :
Code:
ERROR - 2009-04-21 16:24:02 --> Severity: Warning --> unlink(C:\web/system/cache/1c383cd30b7c298ab50293abdfecb7b18) function.unlink: Permission denied C:\web\system\codeigniter\Common.php 63
The problem is caused by the random file used in the function :
Code:
$file = rtrim($file, '/').'/'.md5(rand(1,100));
There is a maximum of 100 unique files used to test the function, chances are that the same file is used concurrently by 2 requests resulting in one of them to fail.
Replacing rand(1,100) by uniqid('',TRUE) fixed the problem on my machine.
Code:
$file = rtrim($file, '/').'/'.md5(uniqid('',TRUE));
I'm not sure if uniqid is the best thing to use here, but used with the
more_entropy parameter seems to makes it very random.