Generating a thumbnail may take a long time and cause Redmine to hang
|Target version:||Candidate for next major release|
Redmine::Thumbnail.generate generates thumbnails, some input files can take a very long time to generate thumbnails, causing Redmine to hang.
Today, in my environment, Redmine tried to generate a thumbnail for a particular PDF file and it took almost an hour (3,521,455ms) and finally raised an error. Because there were multiple accesses to the issue with the PDF attached, all processes of Redmine were occupied with the generation of a thumbnail. As the result, all other requests were not accepted and users could not see any page of Redmine.
Creating thumbnail failed (`convert /*****/*****.pdf -thumbnail 100x100> png:-` failed with error: convert-im6.q16: no images defined `png:-' @ error/convert.c/ConvertImageCommand/3229 ): Completed 404 Not Found in 3521455ms (ActiveRecord: 13.3ms | Allocations: 27136)
The attached patch sets the timeout of
convert command to 10 seconds to prevent similar problems from occurring.