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

[Web] "Maximum call stack exceeded" with dev_build=yes on Quest browser #93476

Closed
dsnopek opened this issue Jun 22, 2024 · 3 comments
Closed

Comments

@dsnopek
Copy link
Contributor

dsnopek commented Jun 22, 2024

Tested versions

Reproducible on:

  • v4.3-beta2
  • 37cf266b578864096bb7160c4f14fa8ac61fc38b or later

System information

Meta Quest 3, Meta Quest Browser, Emscripten 3.1.61

Issue description

Using dev_build=yes with a web build, Godot crashes with "Maximum call stack exceeded" right after start up.

When building without dev_build=yes, then everything works fine!

Via git bisect, I've discovered that 37cf266 is the first revision to introduce the issue.

It's a relatively weird commit to cause the problem, because it's just changing the order that platform specific flags are applied. However, maybe dev_build=yes was supposed to override something that after that change it doesn't? I still need to experiment with that part.

UPDATE: See my further research below!~

Steps to reproduce

  • Checkout master
  • Build with scons platform=web target=template_debug dev_build=yes
  • Export a WebXR project
  • Open with Meta Quest Browser
  • After loading finishes, the game fails to start with "Maximum call stack exceeded"

Minimal reproduction project (MRP)

I've been testing with this project: https://gitlab.com/snopek-games/godot4-webxr-demo

@AThousandShips

This comment was marked as outdated.

@dsnopek
Copy link
Contributor Author

dsnopek commented Jun 22, 2024

Using verbose=yes, I grabbed build commands (one compilation, one linking) to see the flags before and after 37cf266.

Before:

em++ -o core/error/error_macros.web.template_debug.dev.wasm32.o -c -std=gnu++17 -fno-exceptions -s USE_PTHREADS=1 -gdwarf-4 -g3 -Os -Wall -Wshadow-field-in-constructor -Wshadow-uncaptured-local -Wno-ordered-compare-function-pointers -DDEBUG_ENABLED -DDEV_ENABLED -DWEB_ENABLED -DUNIX_ENABLED -DGLES3_ENABLED -DJAVASCRIPT_EVAL_ENABLED -DPTHREAD_NO_RENAME -DMINIZIP_ENABLED -DBROTLI_ENABLED -DTHREADS_ENABLED -DCLIPPER2_ENABLED -DZSTD_STATIC_LINKING_ONLY -Ithirdparty/zstd -Ithirdparty/zlib -Ithirdparty/clipper2/include -Ithirdparty/brotli/include -Iplatform/web -I. core/error/error_macros.cpp

em++ -o bin/godot.web.template_debug.dev.wasm32.js --profiling-funcs -s INITIAL_MEMORY=32MB -s USE_WEBGL2=1 -s OFFSCREEN_FRAMEBUFFER=1 -s GL_ENABLE_GET_PROC_ADDRESS=1 -s STACK_SIZE=5120KB -s USE_PTHREADS=1 -s DEFAULT_PTHREAD_STACK_SIZE=2048KB -s PTHREAD_POOL_SIZE=8 -s WASM_MEM_MAX=2048MB -s WASM_BIGINT -s ENVIRONMENT=web,worker -s MODULARIZE=1 -s EXPORT_NAME='Godot' -s ALLOW_MEMORY_GROWTH=1 -s INVOKE_RUN=0 -s EXPORTED_RUNTIME_METHODS=['callMain','cwrap'] -s EXIT_RUNTIME=1 -s GL_WORKAROUND_SAFARI_GETCONTEXT_BUG=0 --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/webxr/native/library_godot_webxr.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/websocket/library_godot_websocket.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/webrtc/library_godot_webrtc.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_audio.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_display.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_fetch.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_os.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_runtime.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_input.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_webgl2.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_javascript_singleton.js ...

After:

em++ -o core/error/error_macros.web.template_debug.dev.wasm32.o -c -std=gnu++17 -fno-exceptions -s USE_PTHREADS=1 -gdwarf-4 -g3 -O0 -Wall -Wshadow-field-in-constructor -Wshadow-uncaptured-local -Wno-ordered-compare-function-pointers -DDEBUG_ENABLED -DDEV_ENABLED -DWEB_ENABLED -DUNIX_ENABLED -DGLES3_ENABLED -DJAVASCRIPT_EVAL_ENABLED -DPTHREAD_NO_RENAME -DMINIZIP_ENABLED -DBROTLI_ENABLED -DTHREADS_ENABLED -DCLIPPER2_ENABLED -DZSTD_STATIC_LINKING_ONLY -Ithirdparty/zstd -Ithirdparty/zlib -Ithirdparty/clipper2/include -Ithirdparty/brotli/include -Iplatform/web -I. core/error/error_macros.cpp

em++ -o bin/godot.web.template_debug.dev.wasm32.js --profiling-funcs -s INITIAL_MEMORY=32MB -s USE_WEBGL2=1 -s OFFSCREEN_FRAMEBUFFER=1 -s GL_ENABLE_GET_PROC_ADDRESS=1 -s STACK_SIZE=5120KB -s USE_PTHREADS=1 -s DEFAULT_PTHREAD_STACK_SIZE=2048KB -s PTHREAD_POOL_SIZE=8 -s WASM_MEM_MAX=2048MB -s WASM_BIGINT -s ENVIRONMENT=web,worker -s MODULARIZE=1 -s EXPORT_NAME='Godot' -s ALLOW_MEMORY_GROWTH=1 -s INVOKE_RUN=0 -s EXPORTED_RUNTIME_METHODS=['callMain','cwrap'] -s EXIT_RUNTIME=1 -s GL_WORKAROUND_SAFARI_GETCONTEXT_BUG=0 --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/webxr/native/library_godot_webxr.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/websocket/library_godot_websocket.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/modules/webrtc/library_godot_webrtc.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_audio.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_display.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_fetch.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_os.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_runtime.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_input.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_webgl2.js --js-library /home/dsnopek/Sync/Projects/default/godot-4/platform/web/js/libs/library_godot_javascript_singleton.js ...

The only difference appears to be -Os changing to -O0: so, switching from optimizing for size, to no optimizations.

If I change my build command to scons platform=web target=template_debug dev_build=yes optimize=size, then, sure enough, it works!

But I guess we probably actually want no optimizations with dev_build=yes, except that it unfortunately seems to lead to exceeding the maximum call stack size on the Quest browser. :-/ I'm not sure what the right solution should be here?

@adamscott @Faless What do you think?

@dsnopek
Copy link
Contributor Author

dsnopek commented Jul 11, 2024

Fixed by #94107

@dsnopek dsnopek closed this as completed Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants