montera34 / pageonex

PageOneX. Analyzing front pages
http://pageonex.com
GNU Affero General Public License v3.0
54 stars 13 forks source link

Error while exporting to JPEG #175

Closed numeroteca closed 10 years ago

numeroteca commented 10 years ago

While exporting the thread http://www.pageonex.com/DeboraLeal/spring-in-brazil/ to JPEG the site returns an Internal Server Error and it crashes.

This is the log:

Parameters: {"utf8"=>"✓", "authenticity_token"=>"wFB1tt4fz4zrNGibSJG707DJGOnpIVL9h8oJaNpda/c=", "width"=>"1150", "username"=>"DeboraLeal", "thread_name"=>"spring-in-brazil"} Image Empty Error in image.thumbnail: Empty input fileapp/assets/images/kiosko/br-br_estado_spaulo/br_estado_spaulo-2013-05-20.jpg' @ error/jpeg.c/EmitMessage/236 Image Empty Error in image.thumbnail: Empty input file app/assets/images/kiosko/br-br_estado_spaulo/br_estado_spaulo-2013-06-05.jpg' @ error/jpeg.c/EmitMessage/236 Image Empty Error in image.thumbnail: Empty input fileapp/assets/images/kiosko/br-br_estado_spaulo/br_estado_spaulo-2013-06-16.jpg' @ error/jpeg.c/EmitMessage/236 Image Empty Error in image.thumbnail: Empty input file app/assets/images/kiosko/br-br_estado_spaulo/br_estado_spaulo-2013-06-17.jpg' @ error/jpeg.c/EmitMessage/236

In other threads, also with missing images, I can not repeat this behaviour. It might be related to the high number of images in the thread (around 360) and lack of memory in the server?

rahulbot commented 10 years ago

probably memory - because exporting to 800px worked fine. I'll have to look and see if the code can be optimized from a memory point-of-view. or at least handle memory failures more gracefully... for instance, perhaps generate separate topic-overlay and front-page-grid images separately from the composite, and offer a zip download with all those images? That way even if the composite can't be generated at least the user could combine them all in an image-editing program?

numeroteca commented 10 years ago

well, that could be a good temporary fix qit plus an added feature: the possibility to select topics in the final image. The downside is the difficulties for unexperienced people with image graphics programs. For some people adding layes might be too complicated, but if it is the only way for now, let's go for it (the zip with all the images). I will write a tutorial to mix the images again in gimp.

On Tue, Jul 30, 2013 at 10:27 PM, rahulbot notifications@github.com wrote:

probably memory - because exporting to 800px worked fine. I'll have to look and see if the code can be optimized from a memory point-of-view. or at least handle memory failures more gracefully... for instance, perhaps generate separate topic-overlay and front-page-grid images separately from the composite, and offer a zip download with all those images? That way even if the composite can't be generated at least the user could combine them all in an image-editing program?

— Reply to this email directly or view it on GitHubhttps://github.com/numeroteca/pageonex/issues/175#issuecomment-21820157 .

rahulbot commented 10 years ago

I did the low hanging-fruit - downloading a zip file. It reduces the memory footprint too so hopefully this will help the big ones. I'll be able to test once the server is back (!). I made it an option on the popup you get when you select to download an image (e70b3bbe39970609c8f95ecc181e274c2db55c4a)

rahulbot commented 10 years ago

Added some protection against zero-sized files (in 23077596843fd08aad4145526bf25e3a55a00615) - now this works on production. I was able to export the spring-in-brazil thread to an image of size 1150.

numeroteca commented 10 years ago

I was able to export the spring-in-brazil to the zip version, image size of 2000px. great! The good thing is that it includes the jpg with the composite image. So, though user can build a layered image, no need to do so. Why is that it allows the composite image through the zip file and not through the normal jpg export?

rahulbot commented 10 years ago

I don't understand, I was able to download the composite 2000px image through the normal jpg export no problem.

numeroteca commented 10 years ago

Reopening this issue again: "Internal Server Error" while exporting to jpg (also with the .zip exporting way). User reported for this thread http://pageonex.com/Benjamin_Arditi/politica-distribuida-en-mexico/ Only 1200px image export is working for me.

I also get a new type of error: When the image export works the image is displayed on the screen (with the url: http://pageonex.com/Benjamin_Arditi/politica-distribuida-en-mexico/export.jpeg), but when I click right button to download it (firefox, ubuntu 12.01), it and downloads as "results.jpg" that I am not able to open it "Error interpreting JPEG image file (Not a JPEG file: starts with 0x50 0x4b)". When I copy and paste image in another it works, but maybe too complicated for a "normal" user.

When I tried with Chrome and 1800px jpg export it did work!

I think it is related to #179, according to the logs it crashes when "creating background image grid", that still unsolved, ideas?

numeroteca commented 10 years ago

After adding extra RAM to the server it is working ok.