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
closure_callback: Use separate thread for marshalling #181
Conversation
When a thread is yielded (status LUA_YIELD), Lua can get really upset when one tries to execute Lua code on that thread. When LUA_USE_APICHECK is enabled and e.g. things run under code coverage analysis (meaning that debug.sethook() was used to set a hook that runs on various occasions), this can actually result in a failed assertion which aborts the process. Fix this by making closure_callback create a new Lua thread and use that one for all marshaling. Only the results are then moved back to the yielded Lua thread's stack and the coroutine is resumed. Sadly, I cannot provide a nice test case that shows the error before this commit and the fix afterwards. I only got a complicated one. Signed-off-by: Uli Schlachter <psychon@znc.in>
|
Okay, I think this really makes things work for awesome. Just re-enable And then switch to this PR for LGI: Also, some more information on the original bug: You can see that |
|
Yes, the first build failure is due to uploading coverage:
Otherwise I cannot really comment, but your comments/description make sense. |
|
Sigh. In the mean time I found http://lua-users.org/lists/lua-l/2016-08/msg00150.html which suggests that doing memory allocation on a suspended thread is also not allowed since it might cause GC activity which in turn can cause Oh and this PR only fixes half the problem: It only handles parameters, but return values need a similar treatment, too. |
|
Superseded by #183 |
When a thread is yielded (status LUA_YIELD), Lua can get really upset
when one tries to execute Lua code on that thread. When LUA_USE_APICHECK
is enabled and e.g. things run under code coverage analysis (meaning
that debug.sethook() was used to set a hook that runs on various
occasions), this can actually result in a failed assertion which aborts
the process.
Fix this by making closure_callback create a new Lua thread and use that
one for all marshaling. Only the results are then moved back to the
yielded Lua thread's stack and the coroutine is resumed.
Sadly, I cannot provide a nice test case that shows the error before
this commit and the fix afterwards. I only got a complicated one.
Signed-off-by: Uli Schlachter psychon@znc.in
I have the following mess laying around. Before this commit, this caused Lua to fail an assertion and/or segfault. With this commit, everything seems to work fine.
CC @blueyed @Elv13 once again I hope that this fixes all our problems. If one of you has an idea how to run
test-menubar.luaagainst an LGI with this patch, speak up.