ammo.js icon indicating copy to clipboard operation
ammo.js copied to clipboard

Ammo needs Emcscripten flag NODEJS_CATCH_REJECTION

Open NullSoldier opened this issue 4 years ago • 2 comments

Ammo is not currently compiled with NODEJS_CATCH_REJECTION, which it needs to. https://github.com/emscripten-core/emscripten/pull/9061

Without it, emscripten generates JS to inappropriately catch all errors and do heinous things with them. We can see it in the current checked in build https://github.com/kripken/ammo.js/blob/master/builds/ammo.wasm.js if you just search for "unhandledRejection" and "unhandledException".

I work on a cloud based game engine and server, and we use ammo. When there are errors, emscriptem dumps the entire source code to ammo.wasm.js to the logs / terminal, and crashes instead of hitting our error reporting tool. It's because it's minified to be on one line, so the stack trace just prints the entire source code of ammo wasm js. This is really absurd, because we have our own error handlers that are not being called at all.

My workaround is to delete it out of the generated build, or compile it myself with these flags. Anyone using ammo will get screwed by this emscriptem feature, though. We need to use the two flags to disable these handlers from being generated at all. There's 0 use case to want them.

See also https://github.com/emscripten-core/emscripten/issues/7855

NullSoldier avatar Jan 23 '21 17:01 NullSoldier

Thanks for the heads-up... would you be able to make a PR that adds this to the cmake config? Should be around here: https://github.com/kripken/ammo.js/blob/master/CMakeLists.txt#L36-L51

ianpurvis avatar Jan 25 '21 14:01 ianpurvis

I'll put up the PR soon if someone else doesn't beat me to it. I've been super busy lately but I'll definitely find time.

NullSoldier avatar Jan 29 '21 06:01 NullSoldier