Project

General

Profile

Actions

Defect #44378

closed

Ghostscript process is left running when PDF thumbnail generation times out

Added by Go MAEDA 2 months ago. Updated 16 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Resolution:
Fixed
Affected version:

Description

When generating a thumbnail for a PDF attachment, ImageMagick's convert spawns a Ghostscript (gs) process to render the PDF. If the generation exceeds thumbnails_generation_timeout, Redmine::Thumbnail.generate kills the convert process only:

rescue Timeout::Error
  Process.kill('KILL', pid)

The KILL signal is not delivered to the child gs process, so gs keeps running even after convert is gone. This can cause orphaned gs processes to accumulate on servers that receive PDFs that are slow to render.

Steps to reproduce:

1. Set thumbnails_generation_timeout in config/configuration.yml to a small value
2. Attach a PDF file that takes longer than the timeout to render (or replace gs with a script that sleeps)
3. Open a page that displays the attachment thumbnail
4. After the timeout, ps shows the gs process still running


Files


Related issues

Related to Redmine - Defect #44624: Ghostscript process is left running when PDF thumbnail generation times out (missing merge of #44378 in 7.0.2)ClosedGo MAEDAActions
Actions

Also available in: Atom PDF