0

Is there any way of forcibly kill a go routine? I have a function that allows users to input Lua code that will be executed on the server, and the user could potentially send in a infinite loop. I can't stop the routine by a channel, as the execution of the lua code is blocking.

I'm using Gopher lua (found here: https://github.com/yuin/gopher-lua)

u_mulder
  • 54,101
  • 5
  • 48
  • 64
Pownyan
  • 475
  • 1
  • 6
  • 23
  • 2
    No. you will have to come up with a better isolation scheme if you have untrusted input. – JimB Dec 14 '16 at 17:27
  • 1
    :sigh: This is not a duplicate. The answer to your question is here: https://github.com/yuin/gopher-lua/pull/84. Someone added context support, which would solve this problem, but the PR was rejected because they wanted to support older versions of Go. You should fork the project and use their PR. – Caleb Dec 14 '16 at 23:52
  • thanks @Caleb, that solved it – Pownyan Dec 15 '16 at 11:15

0 Answers0