mdns_lite icon indicating copy to clipboard operation
mdns_lite copied to clipboard

DNSBridge no function clause crash

Open fhunleth opened this issue 2 years ago • 2 comments

When running with dns_bridge_recursive: true, it's possible to get this crash with a regular DNS lookup:

20:08:46.153 [error] GenServer MdnsLite.DNSBridge terminating
** (FunctionClauseError) no function clause matching in :mdns_lite_inet_dns.encode_res_section/3
    (mdns_lite 0.8.8) src/mdns_lite_inet_dns.erl:303: :mdns_lite_inet_dns.encode_res_section(<<0, 51, 129, 128, 0, 1, 0, 1, 0, 0, 0, 1, 3, 97, 112, 105, 13, 112, 105, 114, 97, 116, 101, 119, 101, 97, 116, 104, 101, 114, 3, 110, 101, 116, 0, 0, 1, 0, 1, 192, 12, 0, 1, 0, 1, 0, 0, 0, 60, 0, ...>>, {3, {["api", "pirateweather", "net"], 12, nil, {["pirateweather", "net"], 16, {["net"], 30, nil, nil}, nil}}}, [{:dns_rr_opt, ~c".", :opt, 512, 0, 0, 0, "", false}])

One fix is to set dns_bridge_recursive: false and avoid the problematic code.

This issue is to track whether to fix dns_bridge_recursive: true or to remove :dns_bridge_recursive completely since the OTP bug that motivated it has been fixed.

fhunleth avatar Aug 28 '23 00:08 fhunleth

We could just ignore the option and behavior if we detect the OTP version in use is one with the fix?

jjcarstens avatar Aug 28 '23 00:08 jjcarstens

I'm pretty sure you're right. It does seem very desirable to handle this workaround internally and not bother users about it. I just wanted to take a bit of time to refresh my memory on the original issue and OTP DNS resolution before making a PR to remove it.

fhunleth avatar Aug 28 '23 01:08 fhunleth