Page MenuHomePhabricator

Specific file inaccessible at highest resolution
Open, LowPublicBUG REPORT

Description

Tried accessing the highest resolution version of this file. Lower resolutions work fine, but this one doesn't.
This issue happens on whichever browser I try, whether from desktop or mobile.

The error message is as follows:

Request from 185.114.120.52 via cp3051 cp3051, Varnish XID 420319095
Upstream caches: cp3051 int
Error: 429, Too Many Requests at Wed, 02 Feb 2022 13:17:15 GMT

Thanks!

Event Timeline

AntiCompositeNumber added a project: Thumbor.
AntiCompositeNumber edited subscribers, added: AntiCompositeNumber; removed: Commons.

On my machine using current Ghostscript and ImageMagick, gs took 20.81 seconds and convert took 14.73 seconds.

In my local test environment, it ended up being a competition between the timeout and the ImageMagick resource limits. Newer ImageMagick might fix it, but it might need T220171: Generate thumbnails of large JPGs with VIPS instead.

2022-02-02 15:42:32 thumbor:DEBUG METRICS: inc: response.count:1
2022-02-02 15:42:32 thumbor:DEBUG Format specified: jpg
2022-02-02 15:42:32 thumbor:DEBUG METRICS: inc: storage.miss:1
2022-02-02 15:42:32 thumbor:DEBUG Importing: wikimedia_thumbor.loader.https
2022-02-02 15:42:32 thumbor:DEBUG [HTTPS] load_sync: https%3A//upload.wikimedia.org/wikipedia/commons/f/fd/West_Bank_Access_Restrictions.pdf
2022-02-02 15:42:32 thumbor:DEBUG [HTTPS] Loading normalized URL: https://upload.wikimedia.org/wikipedia/commons/f/fd/West_Bank_Access_Restrictions.pdf
2022-02-02 15:42:33 thumbor:DEBUG [HTTPS] return_contents: /tmp/tmpQrVNJg
2022-02-02 15:42:33 thumbor:DEBUG METRICS: inc: original_image.status.200:1
2022-02-02 15:42:33 thumbor:DEBUG METRICS: inc: original_image.response_bytes:4096
2022-02-02 15:42:33 thumbor:DEBUG [Proxy] Looking for a pdf engine
2022-02-02 15:42:33 thumbor:DEBUG [BWE] Found source file in context
2022-02-02 15:42:33 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/gs', '-sDEVICE=jpeg', '-dJPEG=90', '-sstdout=%stderr', '-sOutputFile=%stdout', '-dFirstPage=1', '-dLastPage=1', '-r150', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-q', '-f/tmp/tmpQrVNJg']
2022-02-02 15:42:53 thumbor:DEBUG [ShellRunner] Stdout: <too long to display (5851655 bytes)>
2022-02-02 15:42:53 thumbor:DEBUG [ShellRunner] Stderr: 
2022-02-02 15:42:53 thumbor:DEBUG [ShellRunner] Return code: 0
2022-02-02 15:42:53 thumbor:DEBUG [ShellRunner] Duration: 20218.881
2022-02-02 15:42:53 thumbor:DEBUG [IM] Dumping buffer into temp file
2022-02-02 15:42:53 thumbor:DEBUG [ExiftoolRunner] command: ['/usr/bin/exiftool', '-s', '-s', '-ImageSize', '-ProfileDescription', '-ColorType', '-FileType', '-Transparency', '-Artist', '-Copyright', '-ImageDescription', '/tmp/tmpiqyLUB']
2022-02-02 15:42:53 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/exiftool', '-s', '-s', '-ImageSize', '-ProfileDescription', '-ColorType', '-FileType', '-Transparency', '-Artist', '-Copyright', '-ImageDescription', '/tmp/tmpiqyLUB']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stdout: ImageSize: 4967x7022
ProfileDescription: Artifex Software sRGB ICC Profile
FileType: JPEG

2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stderr: 
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Return code: 0
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Duration: 214.051
2022-02-02 15:42:54 thumbor:DEBUG [IM] EXIF: {'ProfileDescription': 'Artifex Software sRGB ICC Profile', 'FileType': 'JPEG', 'ImageSize': '4967x7022'}
2022-02-02 15:42:54 thumbor:DEBUG [IM] File has non-sRGB profile
2022-02-02 15:42:54 thumbor:DEBUG [ExiftoolRunner] command: ['/usr/bin/exiftool', '-icc_profile', '-b', '-m', '/tmp/tmpiqyLUB']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/exiftool', '-icc_profile', '-b', '-m', '/tmp/tmpiqyLUB']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stdout: <too long to display (2576 bytes)>
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stderr: 
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Return code: 0
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Duration: 154.477
2022-02-02 15:42:54 thumbor:DEBUG [IM] reorientate
2022-02-02 15:42:54 thumbor:DEBUG [IM] resize: 4964.0 7018.0
2022-02-02 15:42:54 thumbor:DEBUG [IM] jpeg:size hint: '9928x14036'
2022-02-02 15:42:54 thumbor:DEBUG [IM] Queued operators: ['-define', 'jpeg:size=9928x14036', '-resize', '4964x7018^', '-gravity', 'center', '-extent', '4964x7018']
2022-02-02 15:42:54 thumbor:DEBUG Image format specified as .jpg.
2022-02-02 15:42:54 thumbor:DEBUG Content Type of image/jpeg detected.
2022-02-02 15:42:54 thumbor:DEBUG [BWE] Rendering jpg
2022-02-02 15:42:54 thumbor:DEBUG [IM] read: jpg 87
2022-02-02 15:42:54 thumbor:DEBUG [IM] Chroma subsampling: '4:2:0'
2022-02-02 15:42:54 thumbor:DEBUG [IM] Generating image with quality 87
2022-02-02 15:42:54 thumbor:DEBUG [IM] Queued operators: ['-define', 'jpeg:size=9928x14036', '-resize', '4964x7018^', '-gravity', 'center', '-extent', '4964x7018', '-quality', '87', '-sampling-factor', '4:2:0', '-interlace', 'Plane']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/convert', '-define', 'tiff:exif-properties=no', '-define', 'jpeg:size=9928x14036', '-resize', '4964x7018^', '-gravity', 'center', '-extent', '4964x7018', '-quality', '87', '-sampling-factor', '4:2:0', '-interlace', 'Plane', '/tmp/tmpiqyLUB[0]', u'jpg:-']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stdout: 
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stderr: convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.

2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Return code: 1
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Duration: 76.31400000000001
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/convert', '/tmp/tmpGirKX4', 'info:']
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stdout: 
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Stderr: convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
convert: no images defined `info:' @ error/convert.c/ConvertImageCommand/3258.

2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Return code: 1
2022-02-02 15:42:54 thumbor:DEBUG [ShellRunner] Duration: 34.524
2022-02-02 15:42:54 thumbor:ERROR [ThreadPool] Failed to convert image convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/thumbor/context.py", line 268, in _execute_in_foreground
    returned = operation()
  File "/usr/lib/python2.7/dist-packages/thumbor/handlers/__init__.py", line 334, in _load_results
    results = context.request.engine.read(image_extension, quality)
  File "/usr/lib/python2.7/dist-packages/wikimedia_thumbor/engine/proxy/proxy.py", line 133, in read
    ret = self.__getattr__('read')(extension, quality)
  File "/usr/lib/python2.7/dist-packages/wikimedia_thumbor/engine/__init__.py", line 40, in read
    return super(BaseWikimediaEngine, self).read(extension, quality)
  File "/usr/lib/python2.7/dist-packages/wikimedia_thumbor/engine/imagemagick/imagemagick.py", line 332, in read
    raise ImageMagickException('Failed to convert image %s' % stderr)  # pragma: no cover
ImageMagickException: Failed to convert image convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.

2022-02-02 15:42:54 thumbor:ERROR [BaseHander.finish_request] Failed to convert image convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/thumbor/handlers/__init__.py", line 391, in inner
    future_result = future.result()
  File "/usr/lib/python2.7/dist-packages/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/lib/python2.7/dist-packages/concurrent/futures/_base.py", line 357, in __get_result
    raise type(self._exception), self._exception, self._traceback
ImageMagickException: Failed to convert image convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.

2022-02-02 15:42:54 thumbor:WARNING Error while trying to fetch the image: Failed to convert image convert: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert: cache resources exhausted `/tmp/tmpiqyLUB' @ error/cache.c/OpenPixelCache/3943.
convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3258.

2022-02-02 15:42:54 tornado.access:ERROR 500 GET /thumbor/unsafe/4964x/filters:format(jpg)/https://upload.wikimedia.org/wikipedia/commons/f/fd/West_Bank_Access_Restrictions.pdf (172.17.0.1) 21651.64ms
2022-02-02 15:42:54 thumbor:DEBUG METRICS: timing: response.time:21650
2022-02-02 15:42:54 thumbor:DEBUG METRICS: timing: response.time.500:21650
2022-02-02 15:42:54 thumbor:DEBUG METRICS: inc: response.status.500:1
2022-02-02 15:42:54 thumbor:DEBUG [HTTPS] cleanup_temp_file: /tmp/tmpQrVNJg

MediaWiki says the file's 4964 x 7020, but ghostscript actually outputs a 4967 x 7022 file (because rounding). So https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/West_Bank_Access_Restrictions.pdf/page1-4967px-West_Bank_Access_Restrictions.pdf.jpg works fine because ImageMagick doesn't have to resize it.