Complex client-side image processing issues with unclear root causes and memory management challenges.
The issue involves investigating and fixing crashes, console errors, and potential out-of-memory issues during client-side image upload processing, particularly with AVIF and HEIC files. Memory management appears problematic, and there is a lack of benchmarking tooling to assess performance. Root causes are not fully understood, and fixes may require deep knowledge of libvips and client-side processing.
During testing of the client-side media processing feature (tracked in #74333), several reports of crashes, console errors, and potential out-of-memory issues have surfaced. These need to be investigated and resolved before wider release. Additionally, we currently lack any benchmarking tooling to establish baseline expectations for processing times, making it difficult to distinguish real regressions from normal variance.
When uploading AVIF images, console errors are consistently produced during conversion. From @sgomes' testing on WordPress 7.0 Beta 5:
These conversions always result in console errors as well, so it's unclear whether they succeeded.
Errors were confirmed across both an M4 Pro MacBook Pro and an HP Chromebook 14 G7.
When performing multiple image conversions in succession, out-of-memory crashes occur. @sgomes observed this on the wasm-vips playground and in WordPress:
After a few runs I start getting crashes with out of memory errors (DevTools were closed until it crashed).
This happens on both powerful and modest machines, though it takes more runs to trigger on higher-spec hardware. This suggests memory is not being properly freed between processing runs.
@adamziel reported that processing a HEIC file crashed entirely:
Processing a HEIC file crashed. I've added a client-side script override and then it hang without any photo preview.
@sgomes' stopwatch measurements on a MacBook showed variance in end-to-end upload times (particularly for AVIF), but without tooling to isolate client-side processing time from upload time and other factors, it's hard to draw conclusions from these numbers alone. The wasm-vips playground handles AVIF-to-JPEG conversion in ~2.7s on a Chromebook, so we know the underlying librar
Claim this issue to let others know you're working on it. You'll earn 35 points when you complete it!