Concurrency bug in production mode

31 views
Skip to first unread message

Joshua Paine

unread,
May 2, 2009, 5:08:07 PM5/2/09
to Recess Framework
Found the source of this deployment problem:

Fatal error: Cannot redeclare class ImageData
in /<redacted>/data/temp/recess.php on line 7947

Turns out there were several copies of my ImageData.class.php file
appended one after another in the class cache file.

ImageData is related to some image generation things this project does.
When you load a page on the site, it typically includes two or more
generated images. The browser requests these in parallel. Recess Library
has to load the ImageData model in both requests. In both requests it
goes on the $missedClasses list. The class cache file is only open for a
moment at the end of the run, so the first of the 'simultaneous' image
requests appends its missed files. The lock only lasts a millisecond or
few, so the second request opens the file to append after only a
millisecond lag and writes the same missed class.

My site happens to hit this bug very reproducibly, but it could happen
less consistently shortly after deploying changes on any site with a lot
of concurrent traffic.

--
Joshua Paine
LetterBlock: Web applications built with joy
http://letterblock.com/
301-576-1920

Kris Jordan

unread,
May 4, 2009, 1:13:37 PM5/4/09
to recess-f...@googlegroups.com
Joshua - 

I was able to reproduce this scenario.

I have committed to the Recess Edge branch some modifications to the production mode features that caused this inconsistency. The commit can be found on GitHub here: http://github.com/recess/recess/commit/cb565a35169915ea45023540dc44d08e871d1995

Try pulling this commit and testing in your application.

Kris
Reply all
Reply to author
Forward
0 new messages