Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught RangeError: Maximum call stack size exceeded ios 13.3.1 #22692

Open
Alexufo opened this issue Oct 8, 2024 · 1 comment
Open

Uncaught RangeError: Maximum call stack size exceeded ios 13.3.1 #22692

Alexufo opened this issue Oct 8, 2024 · 1 comment

Comments

@Alexufo
Copy link

Alexufo commented Oct 8, 2024

In release this causes an error in the console Uncaught RangeError: Maximum call stack size exceeded, but in debug it works. (older versions of ios don't have this)
O3 used

add_link_options(--bind -sWASM -sNO_EXIT_RUNTIME)
add_link_options(--no-entry)
add_link_options(--closure=1)
add_link_options(-sMODULARIZE)
add_link_options(-sENVIRONMENT=web,worker)
add_link_options(-sNO_FILESYSTEM)
add_link_options(-sNO_USE_SDL -sNO_USE_SDL_MIXER)
add_link_options(-sALLOW_MEMORY_GROWTH=1)
add_link_options(-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION=1)
add_link_options(-sDYNAMIC_EXECUTION=1)
add_link_options(-sNO_HTML5_SUPPORT_DEFERRING_USER_SENSITIVE_REQUESTS)
add_link_options(-sNO_ABORT_ON_WASM_EXCEPTIONS)
add_link_options(-sEXPORTED_FUNCTIONS=_malloc,_free)
add_link_options(-sMIN_SAFARI_VERSION=120000)
add_link_options(-sSTACK_SIZE=64mb)
add_link_options(-sINCOMING_MODULE_JS_API=['locateFile','mainScriptUrlOrBlob','printErr'])
add_link_options(-sNO_ERROR_ON_UNDEFINED_SYMBOLS)
add_compile_options(-sSHARED_MEMORY=0)
add_link_options(-sSHARED_MEMORY=0)
add_link_options(-flto)

I checked stack size of safari 13.3.1:

  let i = 0;
  (function inc() {
    if(i % 100 == 0) { console.log(i); 	}
    i++;
    inc();
  })();

And got 6900 - which is the same number as the dektop browser but causes an error only on mobile

@kripken
Copy link
Member

kripken commented Oct 8, 2024

Debug mode might be avoiding the Safari limit by doing less inlining (so stack frames are smaller), but I'm not sure.

To work around this browser issue, you can try optimizing the relevant file with something other than -O3 (like -O2, 1, s, z, etc.). Marking functions as noinline can sometimes help too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants