PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.62k stars 904 forks source link

Lua script loading hangs recursor threads (rec 4.0) #4227

Open mzealey opened 8 years ago

mzealey commented 8 years ago

I had thought that in 4.0 when a script was reloaded it was meant to have been loaded in a separate thread and then given to the rest of the threads. However it seems that this is not the case. Start a normal recursor, create a lua script which freezes on load like:

$ cat loop.lua 
start = os.clock()
while os.clock() - start < 4 do
end

Issue rec_control reload-lua-script /etc/powerdns/loop.lua

This prevents you from being able to do dns queries.

If it is not possible to execute the global context prior to giving script access to the other threads, perhaps you could create eg a initialize or setup function which is called from a separate recursor thread to do any data processing/loading without affecting recursor operation? Such a function could also return true/false to indicate whether or not to replace the current lua script or to rollback the load (as eg a script compilation error would currently do)

mzealey commented 8 years ago

Perhaps related to https://github.com/PowerDNS/pdns/issues/4085#issuecomment-230476810 / #4108