Page MenuHomePhabricator

Stop trying to assess the image dimensions of large files and file chunks
ClosedPublic

Authored by epriestley on Dec 13 2017, 2:48 PM.
Tags
None
Referenced Files
F17948864: D18830.diff
Thu, Jul 31, 10:11 PM
F17948821: D18830.id45183.diff
Thu, Jul 31, 10:05 PM
F17922663: D18830.diff
Wed, Jul 30, 7:06 AM
F17919749: D18830.id.diff
Wed, Jul 30, 2:52 AM
F17916352: D18830.diff
Tue, Jul 29, 10:02 PM
F17760237: D18830.diff
Tue, Jul 22, 7:23 PM
F17625538: D18830.diff
Thu, Jul 10, 3:18 AM
Unknown Object (File)
Wed, Jul 2, 5:01 AM
Subscribers
None

Details

Summary

Depends on D18828. Ref T7789. See https://discourse.phabricator-community.org/t/git-lfs-fails-with-large-images/584.

Currently, when you upload a large (>4MB) image, we may try to assess the dimensions for the image and for each individual chunk.

At best, this is slow and not useful. At worst, it fatals or consumes a ton of memory and I/O we don't need to be using.

Instead:

  • Don't try to assess dimensions for chunked files.
  • Don't try to assess dimensions for the chunks themselves.
  • Squelch errors for bad data, etc., that gd can't actually read, since we recover sensibly.
Test Plan
  • Created a 2048x2048 PNG in Photoshop using the "Random Noise" filter which weighs 8.5MB.
  • Uploaded it.
  • Before patch: got complaints in log about imagecreatefromstring() failing, although the actual upload went OK in my environment.
  • After patch: clean log, no attempt to detect the size of a big image.
  • Also uploaded a small image, got dimensions detected properly still.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

amckinley added inline comments.
src/applications/files/storage/PhabricatorFile.php
43

chunk.jpg (417×467 px, 46 KB)

This revision is now accepted and ready to land.Dec 14 2017, 5:54 PM
This revision was automatically updated to reflect the committed changes.