Up until last week, we were on Babylon v4.1.0-beta.6. We then upgraded to the latest version, which at the time was v4.2.0-beta.10. We noticed a problem in our logs and discovered that on iOS and some mobile devices, there’s a problem related to the resize handler that seems to be triggered when we rotate the device or do scrolling. If we comment out the Babylon resize in thinEngine.ts the problem goes away. It’s been difficult to isolate the issue and create an example of the problem, but we created a POC link with each version. This is now our live version, with Babylon reverted back to v4.1.0-beta.6.
NOTE: These are identical codebases with only Babylon versions changed.
To use the customizer, scroll down to the button that says “customize”, and you can interact with various parts to swap colors or materials.
We are seeing the following issues, which may or may not be related when using the latest version:
Safari 14: If you open the page on iOS Safari 14 and rotate your device, there is a context lost error and WebGL crashes.
Safari 14: When the app crashes, we’ll see calls to load KTX files with malformed URLs. These will be re-appending the KTX extensions, so we’ll see something like “myfile-dxt.ktx” changed to “myfile-dxt-dxt.ktx”.
Safari 14: Open the page, and choose “customize”, then “done”, then “customize” again, then “done” again, and then scroll the page, you’ll see the error that says “a problem repeatedly occurred”. This seems related to the “context lost” issues but is also forcing the page to refresh multiple times. Using v4.1.0-beta.6 the problem cannot be reproduced.
All mobile versions: there is a noticeable slowdown when scrolling the page affecting many browsers and devices.
We haven’t been able to reproduce this in a playground, unfortunately. We agree it’s difficult to troubleshoot. We’ll try updating to the latest version now…
We also suspected a memory leak and looked at our code to see if we could find one. When reverting versions we saw the issue go away but that doesn’t mean it’s not on our end as well. Could be a memory leak is leading to an issue in Babylon even though it’s not exactly a Babylon issue. We’re still digging into it as well. Thanks for looking at it!
We can repro on MacOS using the browser emulator in Safari, then triggering a device rotation. I am in the process of upgrading to Catalina so I can do it on my machine as well
The hard part now is that to troubleshoot a leak I would usually bisect the code per features to figure where is leak is coming from. Do you think you could share at least the basic model in the playground and maybe your dispose code ??? to see if we could repro ?
We can try to set up a playground tomorrow to try and isolate the issue from the rest of the code. The scene is not disposed and recreated when clicking “done” so there shouldn’t be a memory leak from create/dispose/create…etc…