Re: [BUG?] Segmentation fault in lua_error() - easily reproducible

  • From: imzyxwvu@xxxxxxxxx
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Sun, 14 Dec 2014 22:52:15 +0800

Now there is already a main thread lua and a slave thread lua2. The core of 
this problem is trying to throw an error on an yielded thread lua2, whose 
behavior is *undefined*. No code can be executed on an yielded thread, so how 
can there be an error thrown on it? Did you try throwing an error on lua(which 
is not yielded) instead of lua2?

There is no way to throw an error  on an yielded thread with pure Lua code. At 
least I didn't find one.

Sorry my poor English. 

> 在 2014年12月14日,17:38,"Sergei Zhirikov" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted 
> sender "sfzhi@xxxxxxxxx" for DMARC) 写道:
> 
> Finally, someone with common sense. Thank you.
> 
> Back to the point, which is my original email. Please kindly ignore 
> everything written after that as irrelevant. However, to avoid any further 
> meaningless arguments, here is a modified version of the example code, which 
> does not change anything with respect to the segmentation fault:
> 
> #include <lua.h>
> #include <lualib.h>
> #include <lauxlib.h>
> #include <stdio.h>
> 
> int main()
> {
>   lua_State *lua = luaL_newstate();
>   luaL_openlibs(lua);
>   lua_State *lua2 = lua_newthread(lua);
>   luaL_loadstring(lua2, "coroutine.yield()");
>   int res = lua_resume(lua2, 0);
>   printf("res=%d, top=%d\n", res, lua_gettop(lua2));
>   lua_pushliteral(lua2, "test");
>   lua_error(lua2);
>   return 0;
> }
> 
> 
> ________________________________
> From: William Adams <william_a_adams@xxxxxxx>
> To: luajit@xxxxxxxxxxxxx 
> Sent: Sunday, December 14, 2014 6:13 AM
> Subject: RE: [BUG?] Segmentation fault in lua_error() - easily reproducible
> 
> This argument has devolved into a slapping fight.
> Can you please move on, or get back to a point where meaningful help can be 
> offered.
> 
> Sent from my Windows Phone
> 

Other related posts: