All, I am experiencing segmentation faults when using wasm workers. Overview: I am working on a project with considerable 3D data sets. The code has been stable for a while when running in the main thread alone. Then I started using js workers (no shared memory), and again all was well. Now I've switched to SharedArrayBuffers and wasm workers, and I keep running into random problems. I have prepared the code such that I can run with 0 workers up to hardware.concurrency workers. All is well with 0 workers, but as soon as I use one or more workers, I keep getting segfaults because of invalid pointers, access out of bounds and similar.
What happens in main thread and what in the wasm workers: I allocate all objects in the main thread when importing the 3D file. Then i fire off a function for each object that will do some serious calculations of the data, including allocating and disposing of memory. The workers allocate approx. 300 to 400 MB in addition to the main thread. All this happens in the same sharedArrayBuffer, of course. Here is what I've tried so far: - compiling with SAFE_HEAP=1 not a lot of helpful information, - compiling with -fsanitize=address everything works without problems here! - compiling with ASSERTIONS=2 gave me this information: [image: error.png] To me it looks like another resize call is executed while other workers keep working on the buffer, and then something gets into conflict. To test this, I allocated 1.8 GB right after startup in the main thread and disposed the mem blocks again just to trigger heap resize. After that everything works like a charm. Is there anything I am doing wrong? Sorry for not providing a sample, but there is a lot of code involved, and it is not easy to simulate this behavior. Happy to answer questions. All comments are appreciated. Thanks, Dieter -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/c28d7d93-9485-4792-bb34-4016bf3bd703n%40googlegroups.com.