CakePHP Requests Blocking

I just finished tracking down a bug that I’ve been working on for nearly two days, and it turns out to have been something VERY simple.

The basic problem was that while a long running CakePHP request was running, the rest of the Cake app was non-responsive. This is because of a ‘feature’ of PHP. A given session can only be accessed by one apache thread at a time. Since CakePHP auto-starts sessions by default, my long running process was blocking all other requests to the UI, causing them to simply hang until the long process was complete. I solved it by turning off session autostart, and only activating sessions where I need them.

The critical clue came from this post: http://www.nabble.com/Cake-Stalling-(or-blocking)-td20769012.html

So, if you experience something similar, make sure to check your sessions.

%d bloggers like this: