question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opening corrupt Aperio SVS file causes Out-of-Memory error

See original GitHub issue

Hi @cgohlke

I encountered a corrupted AperioSVS file that causes a machine with 64GB of ram to run out-of-memory when trying to instantiate the TiffFile instance. Creating the instance causes a dramatic increase in process memory usage in the TiffTag loading part of tifffile, which just causes the server to kill the python process. Ideally I would expect the code to just crash early, so that cleanup can happen in python.

Sadly I can’t share the file, so here’s some additional information:

The filesize is 5958078846 bytes and it’s recognized as TIFF.CLASSIC_LE tifffile detects tagno=3126 tags, of which almost all raise an unknown tag data type error. Then for tag tagno=2327 it calls TiffTag.from_file with offset=3256275384 and header=b'\x01\x00\x02\x00\x00?\x00\xeb5\x05\x92\x1b'

from_file

Which due to the large count causes a ~4.000.000 character string to be unpacked later in this code path and due to some string ops causes a massive increase in Memory consumption.

I was wondering if there are upper bounds on the amount of data a TiffTag can contain, and this codepath could error early.

Cheers, Andreas 😃

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cgohlkecommented, Nov 2, 2021

Should be mitigated by v2021.11.2, which delay-loads non-essential TIFF tag values.

0reactions
ap--commented, Nov 8, 2021

Tested with all corrupted files that were problematic and it works perfectly now. Thank you so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem opening .svs in Qupath 0.3.2 - Image.sc Forum
We just found a solution using Aperio ImageScope: Extract image region; Save as .svs JPEG 2000. Then the image can be opened in...
Read more >
Aperio ImageScope - User's Guide - Leica Biosystems
To open an eSlide image from Aperio ImageScope, follow these steps: 1. Go to the Aperio ImageScope File menu and select Access Remote...
Read more >
Failed to allocate memory for to read TIFF directory · Issue #153
I am processing an Aperio svs file and I see a message related to a TIFF file. Is there an error in the...
Read more >
Highest scored 'openslide' questions - Stack Overflow
I'm using openslide-python to open a svs image, and I have run into the following issue: >> import openslide as osi >> a...
Read more >
Reading in Aperio SVS files - Open Microscopy Environment
I was trying to read in SVS files generated by an Aperio Microscope directly into OMERO---- the bioformats library says it supports the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found