Skip to content

NodeJS Inconsistent response from the DNS library #40690

@TIRTAGT

Description

@TIRTAGT

Version

v14.18.1 ( with other versions too.... )

Platform

Linux btwiusearchvps 5.14.14-arch1-1 #1 SMP PREEMPT Wed, 20 Oct 2021 21:35:18 +0000 x86_64 GNU/Linux

Subsystem

dns.js

What steps will reproduce the bug?

  1. Install NodeJS
  2. Create a file, and paste the test code :
var InternalNodeDNS = require("dns");
InternalNodeDNS.resolveAny("app.tabnine.com", (err, data) => {
    if (err) {
        // Error on the dns library
        throw err;
    }
    
    console.log(data);
});
  1. Check the response from above code.
  2. Check if the response are the expected result :
[{ value: "_gcp-static-ip-production-1.tabnine.com", type: "CNAME" }]

or an exception instead :

Error: queryAny EBADRESP app.tabnine.com 

How often does it reproduce? Is there a required condition?

This issue will only happen with these conditions :

  • Specific NodeJS version ( few are listed below )
  • Domain/Subdomain with a "_" (underscore) in it. Example : _gcp-static-ip-production-1.tabnine.com

Based on tests I had done, the issue will happen on these NodeJS version :

v16.10.0 ( Tested on RunKit )
v14.18.0 ( Tested on my production Server )
v14.17.6 ( Tested on RunKit )
v14.8.1 ( Tested on my development Server )
v12.22.6 ( Tested on RunKit )

While these NodeJS version won't produce the issue on my tests :

v15.14.0 ( Tested on RunKit )
v13.14.0 ( Tested on RunKit )
v11.15.0 ( Tested on RunKit )
v10.24.1 ( Tested on RunKit )
v9.11.2 ( Tested on RunKit )
v8.17.0 ( Tested on RunKit )

What is the expected behavior?

Responses with a correct DNS response data, not an exception.
I used app.tabnine.com as my test case DNS data.

The result should be an :

[{ value: "_gcp-static-ip-production-1.tabnine.com", type: "CNAME" }]

which is an equivalent to the dig DNS lookup utility :

[matthewtirta@btwiusearchvps ~]$ dig ANY app.tabnine.com @8.8.8.8

; <<>> DiG 9.16.22 <<>> ANY app.tabnine.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6307
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;app.tabnine.com.		IN	ANY

;; ANSWER SECTION:
app.tabnine.com.	300	IN	CNAME	_gcp-static-ip-production-1.tabnine.com.

;; Query time: 73 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Nov 01 19:07:48 WIB 2021
;; MSG SIZE  rcvd: 86

or the nslookup response :

[matthewtirta@btwiusearchvps ~]$ nslookup app.tabnine.com
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
app.tabnine.com	canonical name = _gcp-static-ip-production-1.tabnine.com.
Name:	_gcp-static-ip-production-1.tabnine.com
Address: 35.244.201.191

What do you see instead?

An exception :

Error: queryAny EBADRESP app.tabnine.com at QueryReqWrap.onresolve (as oncomplete) in core node:dns  line 213

Additional information

From the exception message, it looks like that the inner exception was coming from this function :

function onresolve(err, result, ttls) {
  if (ttls && this.ttl)
    result = ArrayPrototypeMap(
      result, (address, index) => ({ address, ttl: ttls[index] }));

  if (err)
    this.callback(dnsException(err, this.bindingName, this.hostname));
  else
    this.callback(null, result);
}

Source :
NodeJS v16.9.0 dns.js lib

I sadly do not have enough resource to test each NodeJS releases, so I just listed all that I tested in hope that it will help narrows down the issue.

This bug is currently impacting my custom private DNS server from being able to resolve any subdomains/domains, while I only have 1 test domain, I can't really 100% figure out if it's really just because of the underscore or not.

The app.tabnine.com are not my domain, I'm a tabnine user and was just confused on why I can't load up my tabnine account dashboard and my private DNS throws a lot of EBADRESP error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    caresIssues and PRs related to the c-ares dependency or the cares_wrap binding.duplicateIssues and PRs that are duplicates of other issues or PRs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions