-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
longjmp in Lua producing unexpected behavior in Emscripten 2.0.11 #13166
Comments
When you have this working with 1.40.1 do you know if you were using fastcomp or the llvm backend. Can you confirm by trying with |
It works just fine on both
I believe I was using LLVM before as well. I remember getting notices about fastcomp and I think I switched to LLVM then. Shouldn't really affect the outcome of this issue, as both fastcomp & LLVM work correctly on 1.40.1. I'm going to continue testing on each version until the bug appears again. |
I've tracked down the issue's introduction to 2.0.1. I don't see any commits related to |
After a lot more testing, I've come to these conclusions:
I've also looked through the changelog, and I wonder if #12056 in 2.0.5 may have caused or otherwise influenced this issue? I currently can't test between 2.0.4 and 2.0.5 due to the aforementioned segfaults, but I might be able to put together a proper minimal reproduction example to fully test this later. |
Thanks for investigating. If you could come up with a minimal test case that would great. |
Does this still appear with the ToT? Have you checked with #12056 reverted? |
I've been working on updating the WebAssembly version of an app I develop to the latest release, and I've run into an odd bug after updating to Emscripten 2.0.11. When calling
longjmp
to yield a coroutine in Lua, the execution appears to resume not at thesetjmp
as expected, but instead after the function (chain) thelongjmp
was triggered in. Here's the code that's getting run (with a bunch ofprint
statements for debugging):When this runs, I get output in the console similar to this:
I'd expect the execution to restart at the
setjmp
call (double-returning, with a value of 1 in this case), but instead it continues from after the function's called.I'm not sure why this is happening at all. The last version I tested this with was 1.40.1, which worked just fine (it's currently in production as well). I don't really have much time to try to bisect this issue right now, but I might be able to check later.
The code I'm using (minus the print statements) is available at MCJack123/craftos2-lua. It's based on Lua 5.1.5, with a number of patches including a fix for yielding across C-calls. I've also attached the built Lua library (with prints) if desired: liblua.a.gz
I'm running Emscripten 2.0.11 on macOS 11.0 x64, using emsdk to download the tools.
The text was updated successfully, but these errors were encountered: