You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
we have a sample webp file which causes an OOM and we want to understand if this is something we need to expect (reading webp files need a lot of memory) or if there is something not correct in the image reader.
Version information
The version of the TwelveMonkeys ImageIO library in use.
3.9.4
The exact output of java --version (or java -version for older Java releases).
For example:
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
Extra information about OS version, server version, standalone program or web application packaging, executable wrapper, etc. Please state exact version numbers where applicable.
To Reproduce
Steps to reproduce the behavior:
Compile the below sample code
Download the sample image file
Run the code with the sample file and Xmx set to 1024m or lower
See error
Expected behavior
should work with Xmx lower than 1280m
Example code
@Test
public void triggerOOM() throws IOException {
try (final var file = new ClassPathResource("sample-webp-file-for-testing.webp").getInputStream()) {
final var image = ImageIO.read(file);
assertThat(image).isNotNull();
}
}
Less is more. Don't add your entire project, only the code required to reproduce the problem. 😀
java.lang.OutOfMemoryError: Java heap space
at com.twelvemonkeys.imageio.plugins.webp.vp8.MacroBlock.predictUV(MacroBlock.java:492)
at com.twelvemonkeys.imageio.plugins.webp.vp8.MacroBlock.dequantMacroBlock(MacroBlock.java:211)
at com.twelvemonkeys.imageio.plugins.webp.vp8.VP8Frame.decodeMacroBlockRow(VP8Frame.java:366)
at com.twelvemonkeys.imageio.plugins.webp.vp8.VP8Frame.decode(VP8Frame.java:346)
at com.twelvemonkeys.imageio.plugins.webp.WebPImageReader.readVP8(WebPImageReader.java:657)
at com.twelvemonkeys.imageio.plugins.webp.WebPImageReader.readVP8Extended(WebPImageReader.java:484)
at com.twelvemonkeys.imageio.plugins.webp.WebPImageReader.readVP8Extended(WebPImageReader.java:463)
at com.twelvemonkeys.imageio.plugins.webp.WebPImageReader.read(WebPImageReader.java:441)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1470)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
The text was updated successfully, but these errors were encountered:
While your WebP file is rather large (8000 x 6000 x 3 ~= 140 MB in memory), I have to agree that the memory requirements for decoding seem a bit unreasonable...
I didn't write this code myself, so I don't know it with enough detail to say much about why the requirements are this high, or what can be done to optimize the memory usage. Any insights or suggestions at optimizations are very welcome!
haraldk
changed the title
OOM for webp test file
WebP: OOM for test file
Mar 7, 2023
I'm having a similar issue with running things on a Raspberry Pi box. My project's unit tests fail, but they pass on other platforms (MacOS, Windows, Linux).
Describe the bug
we have a sample webp file which causes an OOM and we want to understand if this is something we need to expect (reading webp files need a lot of memory) or if there is something not correct in the image reader.
Version information
The version of the TwelveMonkeys ImageIO library in use.
3.9.4
The exact output of
java --version
(orjava -version
for older Java releases).For example:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
should work with Xmx lower than 1280m
Example code
Less is more. Don't add your entire project, only the code required to reproduce the problem. 😀
Sample file(s)
sample-webp-file-for-testing.zip
Stak trace
The text was updated successfully, but these errors were encountered: