Closed jamesbarrett95 closed 3 months ago
Hi @jamesbarrett95 After extensive testing we found that the issue is caused by a bug in Chromium causing memory leaks when transferring ImageData to a worker. The bug has been reported to the Chromium team and you can check the status here. We'll follow up with any relevant updates here as well
Hi @eddieavd Thanks for the update. If you receive a resolution timeframe from the Chromium team could you share it here please?
It's true, we also evidenced the same about the implementation in our project. We will be attentive to what can be reported. Thank you very much @jamesbarrett95 for the detail of the error and @eddieavd for the answer. I will also be attentive 😎.
We have raised the issue via Twitter.
This issue seems to happen intermittently, and is caused by congestion in the postMessage
channel.
As you can see in the repro sample here, there are multiple issues that can occur:
ImageData
instance via postMessage
cuts the performance in half. Creating a new object that matches the shape of ImageData
with the Uint8ClampedArray
referenced from the original one massively improves the performance. The same happens if we construct a new ImageData
from a predefined ArrayBuffer
. Both Chrome and Safari don't like having ImageData
instances inside postMessage
messages.ArrayBuffer
(eg the resolution in this case), or not using requestAnimationFrame
, but instead using setInterval(()=>{},0)
, the issue is more likely to occur.
The same is drastically more likely to happen if we don't wait for the worker to post a message back, signalling that it's done working, as the channel becomes oversaturated, and tasks keep queuing up. Note that waiting doesn't guarantee that the GC will run. Triggering GC manually from the dev tools will release the unused memory.We are currently investigating other approaches to try and mitigate the issue.
hey yall, just a quick follow-up, the Chromium team tagged our report as a duplicate of an existing issue. We're expecting updates from their end in the existing report which you can find right here. We'll also be attaching any major updates from the Chromium team in this issue.
Thanks @ivancuric @eddieavd.
In @ivancuric 's post above, it's mentioned that the memory leaks appear in Safari; which isn't a Chromium-based browser.
Has there been a bug raised to Safari's WebKit? Or is there an ongoing investigation to resolve the issue in BlinkID?
Should be resolved in BlinkID v6.5.1 and above
Problem statement:
Since upgrading to version 6.x.x and testing on 5.x.x, our application alternates between receiving the following errors after the
BlinkIdMultiSideRecognizer
and video stream have been initialized successfullyError 1:
Error 2:
Stack trace:
Error 3:
Uncaught TypeError: Cannot read properties of null (reading 'action')
Stack trace:
at context.onmessage (BlinkIDWasmSDK.worker.min.js:15:14117)
Device information to recreate the error
Mobile Device: Samsung A71 Browser: Chrome v112 Blink ID version: 6.0.1 and 5.20.0
Additional information:
Task Manager memory usage:
Example of error 2 appearing on Blink ID, tested with Samsung A71 on Chrome
Example of error 3 appearing on Blink ID, tested with Samsung A71 on Chrome