emscripten
emscripten copied to clipboard
CGAL freezes on boolean operations
It seems that CGAL's boolean operation hang the browser indefinitely. This occurs from time to time seemingly at random. I have heard it's because CGAL's rounding modes are not imported correctly to WebAssembly. Is that true? Is there a way to use CGAL with Emscripten as to avoid the issue?
emcc -v output: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.51 (c0c2ca1314672a25699846b4663701bcb6f69cca) clang version 18.0.0git (https://github.com/llvm/llvm-project f2464ca317bfeeedddb7cbdea3c2c8ec487890bb) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /home/medal/projects/emsdk/upstream/bin
If you run with devtools open can you see what it happening when you such as hang?
I'm not sure what you mean by "rounding modes are not imported correctly to WebAssembly". Wasm doesn't support different rounding modes as of today but I don't see who that would cause browser hands, especially non-deterministic ones.
Okay, after researching the problem a while more, I have identified the problem. It seems that one of CGAL's operations is using recursion, which causes an unhandled stack overflow exception. I have two questions:
- Is it possible to increase Javascript stack size to prevent the exception?
- Is it possible to handle the exception given that it occurs within the Javascript runtime?
Here is some information on javascript stack overflows: https://humanwhocodes.com/blog/2009/05/19/javascript-stack-overflow-error/
Yes you can catch them, and no it not possible to control the stack size in the wild (You can do it with browser flag I suppose but that probably don't work for more folks).