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

Node.js: Successive DNS Requests Fail with Message "Canceled" #106821

Closed
raymondlaw opened this issue Sep 16, 2020 · 2 comments
Closed

Node.js: Successive DNS Requests Fail with Message "Canceled" #106821

raymondlaw opened this issue Sep 16, 2020 · 2 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s)

Comments

@raymondlaw
Copy link

  • VSCode Version: 1.49
  • Node Version v14.3.0
  • OS Version: Windows 10

Steps to Reproduce:

Run this Node.js code (once or twice sometimes it works, more often it prints Canceled)

const dns = require("dns");
const venus = "venus.cs.qc.cuny.edu";
const mars  = "mars.cs.qc.cuny.edu";

dns.resolve(venus, after_venus);
console.log("Prints Immediately 01");
function after_venus (err, records){
    if(err){
        console.error("Failed to resolve", venus);
    }
    else{
        console.log(venus, records);
    }
}

dns.resolve(mars, after_mars);
console.log("Prints Immediately 02");
function after_mars(err, records){
    if(err){
        console.error("Failed to resolve", mars);
    }
    else{
        console.log(mars, records);
    }
}

Capture

Notice the output prints the message "Canceled" despite it never appearing in the code, it's also blue signaling it's a string?
When I run this program from within Terminal everything works as expected, it is only in VSCode that there is an issue.

I've tested with various domains, the problem persists

If the request actually failed, the error messages should print, not this arbitrary string Canceled

I tested with on a separate machine running 1.42 and everything works no "Canceled" message prints,
I then upgraded to 1.49 and upon upgrading the behavior is reintroduced which at least to me confirmed the problem was within vscode.

Does this issue occur when all extensions are disabled?: Yes

@weinand weinand assigned connor4312 and unassigned weinand Sep 16, 2020
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Sep 16, 2020
@connor4312
Copy link
Member

Thanks for the issue and repro. This is a variation of microsoft/vscode-js-debug#161, I'm guessing the old debugger just exited slightly slower which made you not hit this. There are a couple things you can do to work around it (pick one):

  • Set "outputCapture": "std", in your launch.json, so that output is given as a simple string and not subject to races
  • Set "console": "integratedTerminal" to run the program in a real terminal where output is not handled through the debugger

/duplicate

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

4 participants
@weinand @connor4312 @raymondlaw and others