Hi,

We're building a website where we use imagecache on huge high-res images (I'm talking 50+ MB's per file), and sometimes the creation of an image fails. After that, the image is never created and browser drowns in a loop of 307 redirects.

After looking into the code, it turned the problem was caused by the existence of the lockfile of failed attempt, which makes imagecache 'think' that the derivative is still being created, so it simply sends back the temporary redirect.

Attached is a patch is handle these old lockfiles. Basically if the age of a lock file is more than the max_execution_time, then this means that the script stopped/finished before removing the lockfile, which implies a failed operation.

CommentFileSizeAuthor
imagecache.module.patch1.24 KBkhaled.zaidan

Comments

khaled.zaidan’s picture

Hmm, after further search in the issue queue, looks like this issue was already mentioned in #959770: Bad redirect under certain conditions. Comment #3 even has a patch (almost identical to the one provided here, with the difference in the check for what count as an old lockfile).

sandrewj’s picture

You could try the patch here #1243258: use lock.inc instead of a file lock
That will use a database lock system instead of the lock files, which avoids this issue.

You could adjust the patch in that thread to reflect max_execution_time simply by adding a second parameter to the lock wait and lock acquire calls of ini_get('max_execution_time')

I would suggest having this issue, and other lock file related issues, point to the above lock.inc issue. If you don't mind applying the alternate patch so it can be "reviewed and tested by community" that would help.

fizk’s picture

Status: Needs review » Closed (fixed)

Please reopen if this is still an issue with ImageCache 6.x-2.0-rc1.