Project

General

Profile

Actions

Defect #44620

closed

Partially written thumbnails may be served during generation or after a failure

Defect #44620: Partially written thumbnails may be served during generation or after a failure

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

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

Description

Redmine::Thumbnail.generate writes the thumbnail directly to its final path and skips generation whenever a file already exists there. As a result, an incomplete thumbnail can be served in two cases.

First, a request that arrives while ImageMagick is still writing the thumbnail for another request receives an empty or truncated file. This can happen when several users open an issue with image attachments at the same time, and is more likely with PDF thumbnails, which take longer to generate. Since the ETag is based on the thumbnail path, browsers keep showing the broken image even after the thumbnail is complete.

Second, if ImageMagick fails or exceeds thumbnails_generation_timeout, the partially written file is left in place and served from then on. It can only be fixed by deleting the file manually.

The attached patch writes the thumbnail to a temporary file in the same directory, so that it can be atomically renamed to the target path once ImageMagick succeeds. Other requests therefore see either no file or the complete thumbnail. The temporary file is removed if ImageMagick fails or times out.


Files


Related issues 2 (0 open — 2 closed)

Blocked by Redmine - Defect #44624: Ghostscript process is left running when PDF thumbnail generation times out (missing merge of #44378 in 7.0.2)ClosedGo MAEDAActions
Blocks Redmine - Feature #12197: Allow users to set their avatar in RedmineClosedGo MAEDAActions

Updated by Go MAEDA about 1 month ago Actions #1

  • Target version changed from Candidate for next minor release to 7.1.0

Setting the target version to 7.0.3.

Updated by Go MAEDA about 1 month ago Actions #2

  • Blocked by Defect #44624: Ghostscript process is left running when PDF thumbnail generation times out (missing merge of #44378 in 7.0.2) added

Updated by Go MAEDA about 1 month ago Actions #3

  • Target version changed from 7.1.0 to 7.0.3

Updated by Go MAEDA about 1 month ago Actions #4

  • Blocks Feature #12197: Allow users to set their avatar in Redmine added

Updated by Go MAEDA about 1 month ago Actions #5

  • Subject changed from Partially written thumbnails may be served to Partially written thumbnails may be served during generation or after a failure
  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r25268.

Updated by Go MAEDA about 1 month ago Actions #6

  • Status changed from Resolved to Closed

Merged the fix into 7.0-stable branch in r25276.

Actions

Also available in: PDF Atom