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

NodeJS Inconsistent response from the DNS library #40690

Closed
TIRTAGT opened this issue Nov 1, 2021 · 4 comments
Closed

NodeJS Inconsistent response from the DNS library #40690

TIRTAGT opened this issue Nov 1, 2021 · 4 comments
Labels
cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@TIRTAGT
Copy link

TIRTAGT commented Nov 1, 2021

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.

@richardlau
Copy link
Member

Probably the same as #39780. We’re attempting to update to the latest c-ares in #40660.

@Mesteery Mesteery added cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. duplicate Issues and PRs that are duplicates of other issues or PRs. labels Nov 1, 2021
@TIRTAGT
Copy link
Author

TIRTAGT commented Nov 1, 2021

Thanks, any ETA ? @richardlau

@richardlau
Copy link
Member

Not at the moment. We're having some CI issues preventing anything from landing at the moment. Once it's merged into a 17 release we'd usually wait two weeks before releasing in LTS.

@TIRTAGT
Copy link
Author

TIRTAGT commented Nov 1, 2021

Ah I see, I'll keep an eye on the latest release instead of the LTS then :)

@TIRTAGT TIRTAGT closed this as completed Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

3 participants