PlayCanvas crashing when starting game

Just to confirm with everyone, is this the issue that you are running into:

1 Like

More or less, I never see the Playcanvas Load screen, and i my other tabs are frozen but still remember the last frame rendered.

1 Like

Thanks, do any of you have some WASM library in the project? Ammo, Basis etc?

I had the same issue.

The project was using Ammo Wasm. What helped me on that occasion is that I removed the old Ammo folder from the project assets and imported a fresh new one.

Edit:
The trick that helped me before doesn’t actually work. The app keeps freezing.

@yaustar
Yes, this video is identical to what I’ve been experiencing.

Same as this, the cause was the WASM files. And yes the crashing was exactly like your video.

Faced this again. After some digging, I noticed that the JS heap memory is not freed after refresh. A new tab just keeps asking for more.

1 Like

When have people been seeing this issue? Has it been over the last week or so?

For me, it’s been at the start of this week.

Around a week a for me or so.

Edit:
What helped me before (re-iporting Ammo) doesn’t actually work. Importing new Ammo Wasm doesn’t resolve the issue where GC fails to free the allocated memory for Wasm when a browser tab is closed.

I’m struggling again with trying to get a crash :frowning:

Submitted bug to Chromium: 1257249 - chromium - An open-source project to help move the web forward. - Monorail

2 Likes

@yaustar I think you can repro this by an empty project with a single script that creates a hundred or two physical spheres in a loop on initialize. If you launch it, then keep an eye on the heap, while refreshing or reopening the tab. After some tries the app will freeze.

I tried it with a fork of this project earlier today and it just wouldn’t crash. Heap looked fine too Creating Rigid Bodies in Code | Learn PlayCanvas

:frowning:

Started sometime last week.

@LeXXik @Leonidas @Mads_Nielsen @Devortel

I’m still working on repro steps for the Chrome team about this issue. In the meantime, I think I’ve got a way to force the WASM (Ammo and Basis) to always load in the launch tab that I would like you folks to try in the meantime:

(function() {
    if (window.location.href.startsWith('https://launch.playcanvas.com')) {
        var wasm = window.config.wasmModules;
        var timestamp = Date.now();
        // Add a timestamp to the end of URLs
        for (var i = 0; i < wasm.length; ++i) {
            var m = wasm[i];
            if (m.wasmUrl.length > 0) {
                m.wasmUrl += '&bust=' + timestamp;
            } 
            
            if (m.glueUrl.length > 0) {
                m.glueUrl += '&bust=' + timestamp;
            } 
            
            if (m.fallbackUrl.length > 0) {
                m.fallbackUrl += '&bust=' + timestamp;
            } 
        }
    }
})();

Add this as a new script in the Editor and change the loading type to be ‘Before Engine’.

Example project: https://playcanvas.com/editor/scene/1245798

Let me know how you get on with this please :slight_smile:

More data is always good!

4 Likes

That’s a nice and clever trick! Adding it to my project and I will start testing asap.

1 Like

Nice :+1: I will try it as well!

1 Like

Preliminary test of this fix and everything looks good. No crashing as of now.

1 Like

Out of interest, when you saw this issue before, was it after waking the PC from sleep or after a really long Chrome session (several days)?

I started off with a project of mine that was failing yesterday. At first it was working fine. I kept monitoring the JS heap, but it was at the normal level all the time. After working on the project for like 10 minutes, changing non-Ammo related variables and refreshing the launcher, after one of the refreshes the app froze.

At that state, the JS heap was at normal level. Closing the browser completely and opening again did not solve the problem - the app was still freezing. After that I added your cache busting script and the app began to start normally. Closing the browser and opening again would not affect the app start - it would work norrmally. After disabling your script the app got back to freezing on start.

2 Likes