Project

General

Profile

Actions

Defect #44378

open

Ghostscript process is left running when PDF thumbnail generation times out

Added by Go MAEDA 1 day ago. Updated 1 day ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Attachments
Resolution:
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

Actions

Also available in: Atom PDF