Closed surma closed 3 years ago
It works if you scale it down a bit, so I suspect this is a memory issue.
index.tsx:479 Error: Encoding error with this image
@a1xon thank you!
Odd, the -s ALLOW_MEMORY_GROWTH=1
is used, so OOM shouldn't be a problem. Unless the encoder genuinely exceeds 2GB (the default allowed maximum).
It's spooky if so, but might be worth trying to add -s MAXIMUM_MEMORY=4GB
here https://github.com/GoogleChromeLabs/squoosh/blob/4768bc17ba7949e569753680eb5b90853d0c1ac3/codecs/avif/Makefile#L25 to up the output to the newly supported limit (https://v8.dev/blog/4gb-wasm-memory#trying-it-out).
If that doesn't help, then it's likely a different kind of issue.
I am able to encode the image provided by surma without issue.
However, while trying to encode several different images, my page has crashed with SBOX_FATAL_MEMORY_EXCEEDED
.
I am not able to isolate any particular scenario that always crashes the page, but it happens more often on larger images with higher quality settings. Definetely seems like a memory issue to me.
This is in Chrome 85.0.4183.83 on Windows 10 2004
Yeah if it's OOM then the only thing we can do is increase to a 4GB limit and hope that the upstream encoder gets better optimisations over time.
Is there anything the community could help with to push the fix forward?
@wojtekmaj If you can reproduce the bug, you could try adding -s MAXIMUM_MEMORY=4GB
to the AVIF Makefile and rebuild the codec, as @RReverser outlined. If that fixes the bug, we’d be happy to merge that PR.
We've had some AVIF updates since. I've rechecked and, at least on a laptop and on default settings, the images above compress successfully now.
It's still possible for AVIF or any other codec to run out of memory on even larger images, but I think we can close this issue for now.