[tarantool-patches] Re: [PATCH v7 1/6] lua: remove exceptions from function luaL_tofield()

Konstantin Osipov kostja at tarantool.org
Thu Jan 17 14:40:07 MSK 2019


* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/01/16 21:29]:
> 3. In my opinion there is still a problem with lua_* methods,
> throwing exceptions on OOM *and on a simple stack overflow*.
> Even fixed GC will not fix the problem if all memory is
> occupied by non-garbage memory. I adhere to my opinion that it
> is better to use lua_cpcall. There is nothing bad with it. *_pcall
> just remembers a couple of registers, it is not too expensive for
> such a vast function. Also lua_cpcall causes much less diff.
> 
> We can do it, for example, by renaming luaL_tofield to luaL_tofield_xc
> and introducing new luaL_tofield, calling luaL_tofield_xc via
> lua_cpcall. Just like we used to work with C++ *_xc wrappers.
> 
> Please, ask again in the server team chat about the proposal above.
> Do not forget about stack overflow error, which also is possible and
> does not mean panic. Moreover, it is worth noting that diff is going
> to be much less and simpler. If they decline the proposal, I give in.

Would cpcall help in this case? The patch itself is on track. For
stack issues we should use checkstack(). For general out of memory
issues it's OK to use cpcall, but AFAIU we can add cpcall any time
we need - it's a one line change. The problem is with errors which
can not be caught with  cpcall(), isn't it.


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list