Skip to content

Node.js debugger disconnected too early #104281

@hantingbyte

Description

@hantingbyte
  • VSCode Version:: 1.47.3 (user setup)
  • OS Version: Windows_NT x64 10.0.18363
    Commit: 91899dc
    Date: 2020-07-23T13:12:49.994Z
    Electron: 7.3.2
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0

Steps to Reproduce:

  1. create source code test.js as below
function foo(x){
    let arr = []
    for (let i = 0 ; i < x.length; i++) {
        arr.push(x[i])
        console.log(i, x[i], arr)
    }
}

foo([1, 2, 3])
console.log("done")
  1. change the launch.json as below
{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Launch Current Program",
        "program": "${file}",
        "request": "launch",
        "type": "node"
    }
    ]
}
  1. press F5 and run multiple times, the output could be one of :
D:\Dev\nodejs\node.exe d:\workspace\javascript\test.js
Debugger listening on ws://127.0.0.1:51591/b171a1ab-295b-4dde-b888-5fc5d7d57997
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Process exited with code 0
0 1 (1) [1]
1 2 (2) [1, 2]
done

or

D:\Dev\nodejs\node.exe d:\workspace\javascript\test.js
Debugger listening on ws://127.0.0.1:51718/ca444f52-20f3-4345-9185-e36205b8a1ae
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Process exited with code 0
0 1 (1) [1]
done

but if I set a breakpoint at last line and debug it, then the output would be right

D:\Dev\nodejs\node.exe d:\workspace\javascript\test.js
Debugger listening on ws://127.0.0.1:51781/09bdb609-16c1-41b8-a158-770b42e060a3
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
0 1 (1) [1]
1 2 (2) [1, 2]
2 3 (3) [1, 2, 3]
done
Waiting for the debugger to disconnect...
Process exited with code 0

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

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)debugDebug viewlet, configurations, breakpoints, adapter issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions