Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load zones or crashes on queries #122

Open
SivaKesava1 opened this issue Nov 5, 2020 · 0 comments
Open

Failed to load zones or crashes on queries #122

SivaKesava1 opened this issue Nov 5, 2020 · 0 comments

Comments

@SivaKesava1
Copy link

SivaKesava1 commented Nov 5, 2020

Hi,

I built erldns using make and then added the following file as erldns.config.

[
  {erldns,[
      {servers, [
        [{name, inet_localhost_1}, {address, "127.0.0.1"}, {port, 53}, {family, inet}]
      ]},

      {use_root_hints, false},
      {catch_exceptions, false},
      {zones, "priv/campus.json"}
    ]},
  {lager, [
      {error_logger_redirect, false}
    ]}
].

I have placed the following campus.json file in priv directory.

[
  {
    "name": "campus.edu",
    "records": [
      {
        "name": "campus.edu",
        "type": "SOA",
        "ttl": 3600,
        "data": {
          "mname": "ns1.campus.edu",
          "rname": "root.campus.edu",
          "serial": 3,
          "refresh": 86400,
          "retry": 7200,
          "expire": 604800,
          "minimum": 300
        }
      },
      {
        "name": "campus.edu",
        "type": "NS",
        "ttl": "500",
        "data": {
          "dname": "ns1.outside.edu"
        }
      },
      {
        "name": "*.e.campus.edu",
        "type": "A",
        "ttl": "500",
        "data": {
          "ip": "1.1.1.1"
        }
      },
      {
        "name": "t.e.campus.edu",
        "type": "A",
        "ttl": "500",
        "data": {
          "ip": "2.2.2.2"
        }
      }
    ]
  }
]

Then I ran ./rebar3 release . Though there were some out of date warnings, it successfully assembled it. Then I ran ./_build/default/rel/erldns/bin/erldns foreground which gave the error Failed to load zones (module: erldns_zone_loader, event: read_file_error, reason: enoent). Whatever I did and wherever I placed the file, it gave the same error. I finally tried naming the file as example.zone.json, and it successfully loaded it!! I am not sure what the problem here is, and any help would be useful.

The logs while loading the file were:

09:33:01.061 [info] Loaded zones (count: 1)
09:33:01.061 [info] Notifying servers to start
09:33:01.061 [info] Starting the UDP and TCP supervisor
09:33:01.061 [info] Starting UDP server (family: inet, address: {127,0,0,1}, port: 53)
09:33:01.061 [info] UDP server (family: inet, address: {127,0,0,1}, socket: #Port<0.10>)
09:33:01.062 [info] Starting TCP server for inet on address {127,0,0,1} port 53

Then I queried it using dig @127.0.0.1 +norecurse t.e.campus.edu, which resulted in a huge crash report message. Some parts of that message are:

=ERROR REPORT==== 5-Nov-2020::09:35:40.091530 ===
** Generic server <0.771.0> terminating
** Last message in was {process,
                           {dns_message,46922,false,0,false,false,true,false,
                               ....
** When Server state == {state}
** Reason for termination ==
** {badarg,
       [{dns,encode_message_rec,3,
           ....

=CRASH REPORT==== 5-Nov-2020::09:35:40.092258 ===
  crasher:
    initial call: erldns_worker_process:init/1
    pid: <0.771.0>
    registered_name: []
    exception error: bad argument
      in function  dns:encode_message_rec/3 (/erldns/_build/default/lib/dns_erlang/src/dns.erl, line 590)
      in call from dns:encode_message_rec_list/5 (/erldns/_build/default/lib/dns_erlang/src/dns.erl, line 557)
      in call from dns:encode_message_d_req/5 (/erldns/_build/default/lib/dns_erlang/src/dns.erl, line 423)
      in call from dns:encode_message_def

09:35:50.093 [error] Error handling UDP query (module: erldns_worker, event: handle_udp_query_error, error: {error,{exit,{{badarg,.....
{dns_message,46922,false,0,false,false,true,false,true,false,0,1,0,0,1,[{dns_query,<<"t.e.campus.edu">>,1,1}],[],[],..

System:
OS: Ubuntu bionic (actually a docker image)
Erlang installed using the steps mentioned here as the apt install erlang gave errors for the make.

I am not used to Erlang, so I did not try much to find the root cause. Thanks for any help in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant