You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
atexit callback reads an incorrect value from a TLS variable when -sPROXY_TO_PTHREAD=1 #26040
changed the title [-]atexit callback reads an incorrect value from a TLS variable[/-][+]atexit callback reads an incorrect value from a TLS variable when `-sPROXY_TO_PTHREAD=1`[/+]on Jan 5, 2026
This appears to be happening because we call __funcs_on_exit() on the main browser thread where TLS is not setup. We should either be calling it from the worker pthread thread that calls main or maybe setup TLS on the main thread. I'm guessing the former would be better, but not sure.
Its not that TLS is not setup on the main browser thread, right? Its just that that value of the TLS variable a is never changed except on the proxied main thread, so the value on the main thread remains zero.
Apparently the atexit functions are supposed to always run on the thread which calls exit() so sometimes they do run on different threads, but this is clearly and example of where we are doing the wrong thing since they should be running on the same proxied main thread.
Activity
[-]atexit callback reads an incorrect value from a TLS variable[/-][+]atexit callback reads an incorrect value from a TLS variable when `-sPROXY_TO_PTHREAD=1`[/+]brendandahl commentedon Jan 6, 2026
This appears to be happening because we call
__funcs_on_exit()on the main browser thread where TLS is not setup. We should either be calling it from the worker pthread thread that callsmainor maybe setup TLS on the main thread. I'm guessing the former would be better, but not sure.sbc100 commentedon Jan 10, 2026
Its not that TLS is not setup on the main browser thread, right? Its just that that value of the TLS variable
ais never changed except on the proxied main thread, so the value on the main thread remains zero.Apparently the
atexitfunctions are supposed to always run on the thread which callsexit()so sometimes they do run on different threads, but this is clearly and example of where we are doing the wrong thing since they should be running on the same proxied main thread.sbc100 commentedon Jan 11, 2026
Unfortunately this is going to be quite tricky to fix. It might require a major refactor of how to handle
exitin pthread environments.scripts: Add a script to run the wasm-compiled QEMU on node.js
scripts: Add a script to run the wasm-compiled QEMU on node.js
scripts: Add a script to run the wasm-compiled QEMU on node.js
scripts: Add a script to run the wasm-compiled QEMU on node.js
[PATCH v4 00/33] wasm: Add Wasm TCG backend based on wasm64