I'm trying to understand what happens when lua code raises an error while 
inside a callback. I think there's a problem in the luv implementation, but 
I'm writing here to see if luv authors have already considered this. On line 
60 of lreq.c 
<https://github.com/luvit/luv/blob/f19c3d9469d9cb9d860a91b064163508888d92d6/src/lreq.c#L60>,
 
to invoke the Lua portion of a callback from C, lua_call is used instead of 
lua_pcall. If an error occurs, Lua will use the long jump facility to jump 
out of the call stack which includes calls through libuv. I doubt that 
libuv is written to account for this fact. I'm working on a similar 
callback handler for an external library which uses this same technique.

I see several possibilities:

   1. Luv authors haven't considered this, it's a real problem, but minor 
   enough not to expose serious issues so far
   2. It's not a real problem because libuv can handle the long jumps out 
   of its execution; e.g. all cleanup and calls to free are made before calls 
   to continuation functions.
   3. LuaJIT handles this in some other way that I haven't considered 
   (different from PUC-RIO Lua)


- Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"luvit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to