Out of memory while reading Exif data from JPEG file
See original GitHub issueWhile trying to read exif data from the attached image we got an “out of memory” exception. Looks like the image is somehow corrupted but maybe the exception thrown can be prevented as it tears down the our whole application. Please take a look. Thanks in advance!
Uncaught error from thread [application-thumbnailing-context-26] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.OutOfMemoryError: Java heap space
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readValue(TIFFReader.java:407)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readValueAt(TIFFReader.java:324)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readEntry(TIFFReader.java:298)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readIFD(TIFFReader.java:146)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readSubIFDs(TIFFReader.java:188)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readIFD(TIFFReader.java:158)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readSubIFDs(TIFFReader.java:188)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readIFD(TIFFReader.java:158)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readSubIFDs(TIFFReader.java:188)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readIFD(TIFFReader.java:158)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readSubIFDs(TIFFReader.java:188)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readIFD(TIFFReader.java:158)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.readLinkedIFDs(TIFFReader.java:120)
at com.twelvemonkeys.imageio.metadata.tiff.TIFFReader.read(TIFFReader.java:109)
at com.twelvemonkeys.imageio.metadata.exif.EXIFReader.read(EXIFReader.java:55)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why? Trying to write jpeg in memory and save to file does ...
I'm trying to do the following: 1. Create a memory buffer with valid jpg image. 2. Add Exif data to the jpg image...
Read more >Understanding and Reading Exif Data - CodeProject
This article explains how to retrieve valuable image information from the Exif data found in JPEG images, and provides a Silverlight class ...
Read more >How to remove image metadata from large images without out ...
Problem is that ImageIO.read(...) will read the whole file into memory, which causes OutOfMemory when I'm processing images that are too big. I ......
Read more >How to Obtain Valuable Data from Images Using Exif Extractors
Removing the metadata is useful if you want to make sure an image you're sending doesn't contain data you didn't intend to send....
Read more >How to Read and Remove Metadata from Your Photos ... - Auth0
How can I programmatically detect and read the EXIF metadata from a photo? ... It reads the file's data in binary format into...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for taking too long. My initial fix works reliably only for the first image.
The problem with the second one is different, here the TIFF contains bad offsets, but I have a fix for this issue soon as well.
– Harald K
The fix I made for the first image works for this one as well. I just need to clean the code and create a test case before committing.
– Harald K