Ammo.wasm.js intermittent error

Hi,

We are trying to track down the source of an error on a game which is live at the moment.
The error is very intermittent, and as devs we haven’t seen it emerge on any of our tests but the server log tells us that an occasional user encounters it and cannot recover from it.

The logged entry states that the source is ammo.wasm.js:
‘RuntimeError: call_indirect to a signature that does not match (evaluating ‘Re(e,a,c,d)’)’, path:’/files/assets/67346412/1/ammo.wasm.js’, position:‘507:453’,
user agent info:‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15’,

This is followed by:
‘RuntimeError: call_indirect to a null table entry (evaluating ‘Re(e,a,c,d)’)’, path:’/files/assets/67346412/1/ammo.wasm.js’, position:‘507:453’,

The error occurs in a scene which involves 4 items which don’t move and the player has to drag one of 4 other items onto the correct item (which is one of the first 4 items). This is using default collision logic/events and then relying on entity tags to identify if the collision is ‘correct’.

Has anyone experienced a similar situation before? Any recommendations to fix it?

It’s hard to share a sequestered scene in this case, but the error is coming from deep inside ammo.wasm.js and intermittently, so replicating it is anyways not easily done.

The two screenshots below contain the entity configuration for the fixed entities (tag: ‘collider’) and the moving entities (tag: ‘scrap’)


Thanks.

A quick Google search shows issues in other WASM libraries that it could be related to how it’s been compiled. Might be worth mentioning it to the Ammo repo: https://github.com/kripken/ammo.js/

@yaustar: Do you have version details of the ammo.js that Playcanvas uses? We will report a bug/issue with the Ammo repo.

I’m afraid that I don’t have the version number because Ammo.js doesn’t have version releases IIRC.

I don’t we’ve updated it for at least a year. Side note: You can build Ammo.js or use a different version of Ammo by replacing the WASM files in the project if you need to.

Without a repro, this is difficult to interpret. What the error says is basically that an Ammo method was called with invalid arguments. For example above, a function expects 4 attributes, but probably received more than that or less.

An Ammo method could be anything that is exposed to window.Ammo. If you don’t use any of those in your scripts, then your scripts rely on PlayCanvas API only. Overall, I think engine API is pretty safe, although currently lacking checks from user scripts that you are passing correct values to it. It might be passing an invalid value from your script directly to Ammo, causing this issue.

3 Likes

@LeXXik : Thanks. Yes, however we are only using the PlayCanvas API. We don’t touch window.Ammo.
We only access it through the PlayCanvas API through the code built on the sample examples that use this.entity.collision.on(‘contact’, this.onContact, this);
The only thing done at run time is to enable and disable collisions based on the completion state and we don’t even pass any values ourselves.

@yaustar:We don’t expect much traction with the Ammo.js repo, since intermittent bugs are usually the hardest to figure out. However, it may be useful to leave this here in case others also see the same issue. Rebuilding Ammo.js would be a path to take if there was indication from the repo’s logs that they actually fixed something that was similar to this issue.

Thank you both for your help.

Is the issue always on the same browser version?

We keep an eye out on other reports if/when they come too

1 Like

Currently only one browser UA. Will keep a watch too.