Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploads timing out with Advanced Image Compression enabled #150

Open
Wilto opened this issue Jul 29, 2015 · 9 comments
Open

Uploads timing out with Advanced Image Compression enabled #150

Wilto opened this issue Jul 29, 2015 · 9 comments
Assignees
Labels

Comments

@Wilto
Copy link
Member

Wilto commented Jul 29, 2015

Running into an issue when uploading some image files:

image

No specific PHP error is thrown, but the upload times out calling posterizeImage in the ImageMagick extension. It also only seems to be happening on larger images—specifically larger than 1200x600. Any chance this rings a bell for anyone? @nwtn? I know PHP has a global timeout for transfers, but I’m guessing posterizeImage being called means we’re past that point.

Test images that reproduce the issue are at https://hbp.box.com/s/45r19c026sxtv8tcihhjw2ym0i3rlof8

cc @daigofuji

@nwtn
Copy link

nwtn commented Aug 4, 2015

It could definitely be legit timing out on ImageMagick if the machine is slow or the image is big enough. PHP and Apache both have memory limits and timeout limits for processing, so you may be hitting up against those. If you have control over the config, increasing those limits could help.

@daigofuji
Copy link

Here is the error we get:

[Mon Aug 17 17:40:40.381452 2015] [:error] [pid 13871] [client :59114] 
PHP Fatal error:  Maximum execution time of 1000 seconds exceeded in 
/apps/wordpress/releases/20150817170829/wp-content/plugins/ricg-responsive-images/class-respimg.php
 on line 59, referer:
/wp-admin/upload.php

@joemcgill
Copy link
Member

I believe this is related to issues #116 and #132. Since we've identified the issue best on this ticket, I'm going to close the others and we can keep the rest of the conversation going here.

@joemcgill
Copy link
Member

@nwtn do you think there are some settings we could come up with that would give us most of the image savings and require less memory? Like maybe we experiment with your settings minus optimizations, as you outlined in your Smashing Mag article. What do you think?

@joemcgill
Copy link
Member

Any update here @nwtn?

@Wilto
Copy link
Member Author

Wilto commented Sep 2, 2015

Bump.

@clicknathan
Copy link

I'm not using the advanced image compression and also get the error. Running on a WP Engine server and would be happy to provide any more info I might be able to.
screen shot 2015-12-03 at 8 38 27 am

@lmartins
Copy link

Having the same problem, each time I try to upload an image I get an error in PHP log:

[17-Dec-2015 17:53:00 UTC] PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /srv/wordpress/wordpress/wp-content/plugins/ricg-responsive-images/class-respimg.php on line 53
[17-Dec-2015 17:56:19 UTC] PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /srv/wordpress/wordpress/wp-content/plugins/ricg-responsive-images/class-respimg.php on line 53
[17-Dec-2015 17:58:06 UTC] PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /srv/wordpress/wordpress/wp-content/plugins/ricg-responsive-images/class-respimg.php on line 53

The uploader finally says "HTTP error" and after refresh I get a general icon in the media section:
https://www.dropbox.com/s/k3hb55osh5rq9xd/Screenshot%202015-12-17%2018.07.27.png?dl=0

Cheers.

@joemcgill
Copy link
Member

Spent some time profiling uploads with these settings and it looks like the memory issues are related tot he posterization settings that are being applied. After looking back through @nwtn's old test data it looks like those settings really only benefit PNGs and can actually create slightly larger file sizes when applied to JPG images.

Try commenting out this line in the smartResize() method in 'class-respimg.php' and see if the memory errors go away:

$this->posterizeImage( 136, false );

joemcgill added a commit that referenced this issue Feb 4, 2016
This removes the posterization filter from the advanced image compression
settings to substantially reduce the CPU load which could cause image
resizing to fail (see #150).

After digging into the research @nwtn did to come up with these
settings, it turns out that posterization only improves file sizes
for PNGs and can actually lead to slightly larger file sizes for
JPG images.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants