PowerDNS / pdns

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

C++ exceptions caused by Lua code do not bubble up #3436

Open Habbie opened 8 years ago

Habbie commented 8 years ago

If I put dq:addAnswer(pdns.AAAA, "::1:2:3::4") (note the invalid second ::) in a preresolve method, recursor will log Feb 23 16:39:02 STL error (nu.nl./AAAA from 127.0.0.1): Exception thrown by a callback function called by Lua and will not respond to the query.

  1. I'd like to see the actual failure reason in the logs
  2. I'd like pcall to be able to see the actual reason (right now it appears the exception becomes userdata
  3. Shouldn't we send out SERVFAIL instead of being quiet?
omoerbeek commented 2 years ago

Currently, master logs:

Sep 06 12:01:41 msg="Exception in resolver context " error="[string \"chunk\"]:9: Caught exception: Parsing record content (try 'pdnsutil check-zone'): while parsing IPv6 address: '::1:2:3::4' is invalid
stack traceback:
    [C]: in method 'addAnswer'
    [string \"chunk\"]:9: in function 'preresolve'" subsystem="syncres" level="0" prio="Error" tid="3" ts="1662458501.169" ecs="" exception="std::exception" mtid="1" proto="udp" qname="www.xyz.com" qtype="A" remote="127.0.0.1:60818"

So that is much better than before. Generating a ServFail would be nice, but requires quite some restructuring. I'm postponing that to a later milestone.