Re: Efficient query timeouts in LuaJIT

  • From: Mike Pall <mike-1304@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 30 Apr 2013 23:28:23 +0200

Konstantin Osipov wrote:
> Are there performance tests comparing LuaJIT compiled with and
> without -DLUAJIT_ENABLE_CHECKHOOK? If not, we may need to create a
> benchmark for this.

It shouldn't be so bad unless you have many tight loops. In fact,
given your description, I bet most code is interpreted, anyway.

> Is it safe to call Lua error() (or lua_error()) from the hook?

Yes. Though it may be caught by a pcall in (malicious) user code.

> Now we need to solve the same problem for cases when user code
> has run away completely.

Well, hooks won't help you if it's stuck inside C code (*). Only
process level isolation may solve this.

(*) E.g.: string.rep("a",1000):match("a*a*a*a*b")

--Mike

Other related posts: