emscripten-core / emscripten-core/emscripten

Stack corruption in a concurrent suspension/unsuspension scenario

Open
#20,058 12 comments 0 reactions 0 assignees View on GitHub
asyncify
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
3.1.44

**Failing command line in full:**
make && cd build && emrun main.html

**Full link command and output with `-v` appended:**
See Makefile

When an operation from a dynamic callback is unsuspended, and the code originating at main() has been suspended and unsuspended in the meantime, the stack gets corrupted.
To reproduce, simply run the program as specified in the 'failing command line' section. You should be seeing an error in the console after 5 seconds - the test map in timer callback seems to have been somehow meddled with.
This only happens if the loop in the code is outside of the suspended method for some reason - see the comments in code.

[suspend.zip](https://github.com/emscripten-core/emscripten/files/12366504/suspend.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.