Skip to content

ios 26.2 shared memory issues #25905

@dr-matt

Description

@dr-matt

We're encountering a new issue in our web app since installing ios 26.2 rc as well as the preceding beta versions. This is probably a webkit regression rather than an emscripten bug, but posting here in case others are experienced the same issue and hoping to get a little insight from the wasm / emscripten side.

Our app is multi-threaded and uses growable memory. It works fine in previous ios versions through the current 26.1, but now with 26.2 we are seeing immediate memory-related crashes once wasm processing begins. Rather than out-of-memory, the crashes are due to RuntimeError: Out of bounds memory access buried deep within a dependency library. It has something to do with new allocations - in some cases just a std::vector::resize - but it's been challenging to pinpoint thus far. Release and debug builds both exhibit the problem.

Switching to fixed-memory solves the issue, as does forcing single-threaded mode (pthreads still enabled in the build but limiting threads to 1 at the application level). But the combination of growable memory + multiple threads consistently triggers this crash.

We'll continue to try isolating the problem and come up with a MRE to share here. But in the meantime I wanted to report this to see if there's any corroboration that might help with debugging and/or filing the right bug report.

emcc -v:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.21 (d6f42310010ddec0753a69bab01a4b33aae255b7)
clang version 22.0.0git (https:/github.com/llvm/llvm-project 60513b8d6ebacde46e8fbe4faf1319ac87e990e3)
Target: wasm32-unknown-emscripten
Thread model: posix
command line from cmake:
em++ -O3 -DNDEBUG -flto --bind --no-entry --gc-sections -sFILESYSTEM=0 -sEXPORT_ES6=1 -sENVIRONMENT=web,worker -v -pthread -sPTHREAD_POOL_SIZE_STRICT=0 -SCROSS_ORIGIN=1 -sMALLOC=mimalloc -sALLOW_MEMORY_GROWTH=1 --closure 1 -sASSERTIONS=1 -sNO_DISABLE_EXCEPTION_CATCHING --emit-tsd full.d.ts @CMakeFiles/full.simd.threads.growable.dir/objects1.rsp -o full.simd.threads.growable.js @CMakeFiles/full.simd.threads.growable.dir/linkLibs.rsp

bin/wasm-ld -o full.simd.threads.growable.wasm -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmph1lclr0xlibemscripten_js_symbols.so --import-memory --shared-memory --strip-debug -u__cxa_atexit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=_emscripten_stack_alloc --export=__getTypeName --export=_embind_initialize_bindings --export=_emscripten_thread_free_data --export=_emscripten_thread_crashed --export=__cxa_can_catch --export=__cxa_increment_exception_refcount --export=__cxa_decrement_exception_refcount --export=setThrew --export=__cxa_free_exception --export=__wasm_call_ctors --export=_emscripten_tls_init --export=_emscripten_thread_init --export=_emscripten_stack_restore --export=emscripten_stack_set_limits --export=_emscripten_thread_exit --export=__get_exception_message --export=free --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --max-memory=2147483648 --initial-memory=16777216 --no-entry --no-stack-first --table-base=1 --global-base=1024 -lembind-mt-rtti <lots of objects here> -lGL-mt-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-mt-debug -lmimalloc-mt -lcompiler_rt-mt -lc++-debug-mt -lc++abi-debug-mt -lsockets-mt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions