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

Valid position of --inspect argument during Node.js attachment #212889

Open
Flopriant opened this issue May 16, 2024 · 8 comments
Open

Valid position of --inspect argument during Node.js attachment #212889

Flopriant opened this issue May 16, 2024 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@Flopriant
Copy link

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

  • VS Code Version: 1.89.1
  • OS Version: Windows_NT x64 10.0.22631

Steps to Reproduce:

  1. Do a program in Python 3.9.13 64-bit
  2. Press F5
  3. Nothing happens at all
@mikepaszkiewicz
Copy link

mikepaszkiewicz commented May 16, 2024

I am also getting this, right after updating to the below version, running the below launch.json config. After clicking the process to inspect, the 'Call Stack' section shows RUNNING for around 10 seconds before disappearing.

Same behavior disabling all extensions and restarting.

Inspector shows error:

Error: Could not connect to debug target at http://localhost:9229: Could not find any debuggable target
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:110:38167
    ...
Version: 1.89.0 (Universal)
Commit: b58957e67ee1e712cebf466b995adf4c5307b2bd
Date: 2024-05-01T02:10:10.196Z (2 wks ago)
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0

launch.json

  "configurations": [
    {
      "name": "Attach by Process ID",
      "processId": "${command:PickProcess}",
      "request": "attach",
      "skipFiles": ["<node_internals>/**"],
      "outputCapture": "std",
      "type": "node"
    },
]

image

@roblourens
Copy link
Member

@Flopriant can you open an issue on the Python repo?

@mikepaszkiewicz it looks like maybe your program just failed to start?

@roblourens roblourens assigned connor4312 and unassigned roblourens May 16, 2024
@roblourens roblourens added the info-needed Issue requires more information from poster label May 16, 2024
@mikepaszkiewicz
Copy link

@roblourens the program i'm trying to connect to is definitely running, as I can select it from the process picker and reach via curl.

also just confirmed downgrading to 1.87.2 allows the debugger to conenct


Version: 1.87.2
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:20:57.520Z (2 mos ago)
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.4.0

image

@connor4312
Copy link
Member

connor4312 commented May 17, 2024

I think in your case you have an --inspect argument, but it's in the wrong place and it's not handled by Node.js, it's handled by your process. In microsoft/vscode-js-debug#1987 I made a change so that we don't try to force the process into debug mode if --inspect is already present (since this caused issues in another case.) For you --inspect is present just in the wrong place, it need to be before the script to execute.

We could also be smarter about this in the debugger.

@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues and removed info-needed Issue requires more information from poster labels May 17, 2024
@connor4312 connor4312 changed the title Debugger not working Valid position of --inspect argument during Node.js attachment May 17, 2024
@mikepaszkiewicz
Copy link

@connor4312 Awesome - changing from node build/server/server.js --inspect to node --inspect build/server/server.js appears to have done the trick!

Also of note - removing the --inspect flag from the script entirely fixed the issue as well as far as I can tell, so assume it's perhaps happening behind the scenes?

@connor4312
Copy link
Member

connor4312 commented May 21, 2024

If the process is not launched with --inspect we can (usually) force it into inspect mode, but we skip that code path if we see it's already launched with --inspect

@KrisTC

This comment was marked as off-topic.

@connor4312
Copy link
Member

connor4312 commented May 28, 2024

Your issue is unrelated, please open a bug for the Python extension. This issue is regarding the JavaScript debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

5 participants