[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Should Lua reject (via assertions) calls which may error on a yielded thread?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 9 Aug 2016 17:47:20 -0300
> We yield a thread that issues a blocking a socket operation and later
> resume it via a callback. The resume takes place in a Lua function
> which is called on the yielded thread. This was "okay" to do from a
> past lua-l posting by (I think) Roberto. However, since Lua 5.2,
> apparently there is a new assertion that fails if you call a function
> on a yielded thread.
Do you know which assertion?
> Also, a question I lack time to check: errors on a yielded thread
> could cause catastrophic effects as there is no active lua_resume?
> Does Lua panic? Does it make sense to have Lua just assert fail *all
> API functions which may error* on a yielded thread? It seems to me
> this should be explicitly disallowed in the manual but I found no
Errors in a thread with no handler are "transfered" to the main thread.
If it also has no handler, then Lua panics. (Nevertheless, the whole
process is not very "stable". Other threads which might be active
between the error and the recovery point of the main thread may get
corrupted, because parts of their C stack were destroyed.)
I have to rethink that again, but it does seem a good idea to use
non-main threads only inside resumes.