symphonycms / jit_image_manipulation

Just in Time Image Manipulation for Symphony CMS
http://symphonyextensions.com/extensions/jit_image_manipulation/
Other
25 stars 42 forks source link

Aborted connections #85

Closed nitriques closed 10 years ago

nitriques commented 10 years ago

This was bugging me for a long time and I have a website where this fix is absolutely crucial.

We use jit image in a way that would flood most server: We load tons of images at the same time, and most of them are canceled by the browser but php would still try do all the work, even though it does not need to.

So the fix is pretty simple, it checks regularly if the connection is open. If not, it will simply die.

I tested it a lot and it works really great. Instead of flooding the server and taking all the available RAM, the process just quits as soon as the connection is dropped.

DavidOliver commented 10 years ago

Hi @nitriques,

Typo: Abroted should be Aborted.

nitriques commented 10 years ago

Yeah I can spell that word correctly. ILooks like I commited the file before doing save. Damn. Thanks for reporting it.

DavidOliver commented 10 years ago

I can relate. It took me three commits to change one sentence last night.

nitriques commented 10 years ago

It's fixed :) Even my branch name was off at the start!

nitriques commented 10 years ago

I can relate. It took me three commits to change one sentence last night.

:smile:

nitriques commented 10 years ago

seems like connection_aborted() does not works. :(

DavidOliver commented 10 years ago

It's not because the function returns 0 or 1 as opposed to a boolean, is it? I saw a comment at the PHP manual which suggested that your usage should work, though.

nitriques commented 10 years ago

I did some logging server side and the value is ALWAYS zero, regarding if the connection was dropped or not. Even tried combinations of flush, ob_flush, ob_end and other variant without luck. I even did some test using static files and even apache does not cancel the request, reads the file from disk and sends it to the user. It really sucks.