simogeo/Filemanager — Issue #101: Hang when fetching lots of previews (PHP)
Author: dsl
Created: 2012-02-13 15:50:49+00:00
State: open

Hi,

We have been seeing a problem with fetching lots of previews. What seems to happen, is that some of the previews get stuck and never complete, almost as if they are deadlocked.

The net effect of this is to tie up apache processes - more are spawned to handle other users, however the user that triggers this then finds that the site becomes unresponsive, most likely due to there being too many existing connections (usually around 8) open to this server.

I've seen this occur with both firefox and IE.

Now, the solution (although I can't explain why this fixes it).

In filemanager.php, there is a large switch statement which sends the various different requests off to the right support function in the class.

In the case of preview, it calls preview() in the class, then breaks out of the switch statement, and executes this line:

echo json_encode($response);

In the case of preview, this will have the effect of adding on two speech marks "" to the end of the image data. Why this causes random lock ups, I'm not sure, but if I put in an immediate exit() after calling preview(), the lock ups go away entirely.

I suspect a similar fix will need to be applied to the download() case as well.

Hopefully this report is clear enough, but if you need further information, please let me know.