Page MenuHomePhabricator

"Error: 429, Too Many Requests" for some PNG thumbnails of [[c:File:Ambigram_New_York_Rich_Man.png]]
Closed, ResolvedPublic

Description

Hi. I have been getting the following error at https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Ambigram_New_York_Rich_Man.png/800px-Ambigram_New_York_Rich_Man.png for hours:
"Request from 45.33.139.216 via cp1082 frontend, Varnish XID 836447465
Upstream caches: cp1082 int
Error: 429, Too Many Requests at Mon, 17 Feb 2020 09:29:59 GMT"

See also the discussion at https://commons.wikimedia.org/wiki/Commons:Help_desk#Thumbnail_doesn%27t_display

Event Timeline

Aklapper renamed this task from Error: 429, Too Many Requests to "Error: 429, Too Many Requests" for some PNG thumbnails of [[c:File:Ambigram_New_York_Rich_Man.png]].Feb 17 2020, 2:47 PM
Aklapper added a project: Thumbor.

Thumbnail issue -> Thumbor

The discussion of the display of https://commons.wikimedia.org/wiki/File:Ambigram_New_York_Rich_Man.png was archived automatically to https://commons.wikimedia.org/wiki/Commons:Help_desk/Archive/2020/02#Thumbnail_doesn%27t_display and now I get the following:
Request from 45.33.139.173 via cp1086 frontend, Varnish XID 520356410
Upstream caches: cp1086 int
Error: 500, Internal Server Error at Sun, 01 Mar 2020 14:32:22 GMT

File:Ambigram_New_York_Rich_Man.png loads fine for me, but I get 500 -> 429s on File:Ethiopian_Region_Map_with_Capitals_and_Flags.png.

Request from **** via cp1082 frontend, Varnish XID 361394119
Upstream caches: cp1082 int
Error: 500, Internal Server Error at Wed, 13 May 2020 01:37:45 GMT

ImageMagick processes the file fine, the issue is actually in libexiv2/python-pyexiv2. exiv2 can't read any metadata in the image, so it decides it's corrupt and raises an error.

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/thumbor/handlers/__init__.py", line 140, in get_image
    self.context.request.image_url
  File "/usr/lib/python2.7/dist-packages/tornado/gen.py", line 1015, in run
    value = future.result()
  File "/usr/lib/python2.7/dist-packages/tornado/concurrent.py", line 237, in result
    raise_exc_info(self._exc_info)
  File "/usr/lib/python2.7/dist-packages/tornado/gen.py", line 1024, in run
    yielded = self.gen.send(value)
  File "/usr/lib/python2.7/dist-packages/thumbor/handlers/__init__.py", line 609, in _fetch
    self.context.request.engine.load(fetch_result.buffer, extension)
  File "/srv/thumbor-plugins/wikimedia_thumbor/engine/proxy/proxy.py", line 119, in load
    self.lcl[enginename].load(buffer, extension)
  File "/usr/lib/python2.7/dist-packages/thumbor/engines/__init__.py", line 167, in load
    image_or_frames = self.create_image(buffer)
  File "/srv/thumbor-plugins/wikimedia_thumbor/engine/imagemagick/imagemagick.py", line 77, in create_image
    self.read_exif(temp_file)
  File "/srv/thumbor-plugins/wikimedia_thumbor/engine/imagemagick/imagemagick.py", line 140, in read_exif
    metadata.read()
  File "/usr/lib/python2.7/dist-packages/pyexiv2/metadata.py", line 108, in read
    self.__image._readMetadata()
RuntimeError: corrupted image metadata

This also happens on the command line with exiv2 0.25/libexiv2 0.25-3.1+deb9u1 (stretch):

$ exiv2 -v -Q d -p a pr tests/integration/originals/Ethiopian_Region_Map_with_Capitals_and_Flags.png
File 1/1: tests/integration/originals/Ethiopian_Region_Map_with_Capitals_and_Flags.png
Exiv2 exception in print action for file tests/integration/originals/Ethiopian_Region_Map_with_Capitals_and_Flags.png:
corrupted image metadata

The corrupted metadata error was partially backported to Stretch as a security patch. I'm not completely sure why it's being thrown for this image. I'm thinking it's this patch because it's the only one with the default error message.

Exiv2 0.27.2 correctly identifies that there is no EXIF metadata in the image. I don't know if pyexiv2 would raise an exception or not, I couldn't get it to install on my machine.

$ exiv2 -v -Q d -p a pr Ethiopian_Region_Map_with_Capitals_and_Flags.png 
File 1/1: Ethiopian_Region_Map_with_Capitals_and_Flags.png
Ethiopian_Region_Map_with_Capitals_and_Flags.png: No Exif data found in the file
Ethiopian_Region_Map_with_Capitals_and_Flags.png: No IPTC data found in the file
Ethiopian_Region_Map_with_Capitals_and_Flags.png: No XMP data found in the file

Change 596093 had a related patch set uploaded (by AntiCompositeNumber; owner: AntiCompositeNumber):
[operations/software/thumbor-plugins@master] engine.imagemagick: Catch error when pyexiv2 can't find metadata

https://gerrit.wikimedia.org/r/596093

Change 596093 merged by Gilles:
[operations/software/thumbor-plugins@master] engine.imagemagick: Catch error when pyexiv2 can't find metadata

https://gerrit.wikimedia.org/r/596093

Gilles triaged this task as Medium priority.May 13 2020, 8:29 AM

Change 603876 had a related patch set uploaded (by Gilles; owner: Gilles):
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 2.9

https://gerrit.wikimedia.org/r/603876

Change 603876 merged by Effie Mouzeli:
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 2.9

https://gerrit.wikimedia.org/r/603876