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

stopOnEntry doesn't work #1333

Closed
oweitman opened this issue Jul 17, 2022 · 16 comments
Closed

stopOnEntry doesn't work #1333

oweitman opened this issue Jul 17, 2022 · 16 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@oweitman
Copy link

oweitman commented Jul 17, 2022

Issue Type: Bug

vs code didnt start debug after the node program on remote server is executed.
port 9229 is forwarded from remote to local
if i close vs code and try it with chrome://inspect in the crhome browser. the debug session is shown and i can start it

Extension version: 0.84.0
VS Code version: Code 1.69.1 (b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a, 2022-07-12T08:21:24.514Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No
Remote OS version: Linux x64 4.19.0-18-amd64

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 x 4008)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.93GB (9.41GB free)
Process Argv --crash-reporter-id bbd4b258-0071-4bdb-a494-98887c18d752
Screen Reader no
VM 0%
Item Value
Remote SSH: 192.168.1.61
OS Linux x64 4.19.0-18-amd64
CPUs Intel(R) Celeron(R) CPU J3455 @ 1.50GHz (4 x 2196)
Memory (System) 15.52GB (0.94GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30525689
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549

@tanhakabir
Copy link

Just to clarify you are using code-server here?

@tanhakabir tanhakabir added the info-needed Issue requires more information from poster label Jul 18, 2022
@oweitman
Copy link
Author

oweitman commented Jul 18, 2022

yes
when I connect to the server via ssh, software from vs code is installed on the remote server and started from directory /home/user/.vscode.
serveral processes are running
local client is windows
remote server is debian

@connor4312
Copy link
Member

I don't think the code-server label is correct on this one.

Can you share a gif of what you're seeing/trying to do? https://gifcap.dev/ is helpful.

@connor4312 connor4312 self-assigned this Jul 19, 2022
@oweitman
Copy link
Author

vscode_node_remotedebug

ok, i created a gif and an simple program https://github.com/oweitman/remotetest
Although a breakpoint is set in the first line, I have set the stopOnEntry option in launch.json to be on the safe side

First i start the debugging in vs code, but nothing stops
Next i start the debugging from shell with

node --inspect-brk index.js
chrome://inspect shows nothing
this is the proof, that port 9229 is not forwarded to the client machine

Next i start the debugging from shell with the remote option
node --inspect-brk=192.168.1.61 index.js
chrome://inspect shows the debug session and the debugger of chrome starts.

what can i check further?

@connor4312 connor4312 changed the title vs code didnt start debug stopOnEntry doesn't work Jul 20, 2022
@connor4312 connor4312 transferred this issue from microsoft/vscode-remote-release Jul 20, 2022
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jul 20, 2022
@oweitman
Copy link
Author

thank you for accepting as bug.
the title didn't really matter, but vs Code didn't stop at the breakpoint either

@connor4312
Copy link
Member

connor4312 commented Aug 4, 2022

@oweitman Could you also grab some trace logs using these instructions?

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to connor@xbox.com

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Aug 4, 2022
@oweitman
Copy link
Author

oweitman commented Aug 6, 2022

here it is

vscode-debugadapter-5e084d53.json.gz

@oweitman
Copy link
Author

is the info sufficient?

@connor4312
Copy link
Member

It appears that Node.js on the remote machine is not properly reaching or respecting the environment variables set for it by the debugger. How was it installed? Is /usr/local/bin/node Node.js itself or a link to another location?

@oweitman
Copy link
Author

oweitman commented Oct 5, 2022

which node replies
/usr/local/bin/node
and there is also the real application (no link)

a search for executable node returned this

/var/lib/docker/overlay2/a3176ff291203ba4f98a10cbd90cfee35c8101f13698e08443f15c2c4dfeac3f/diff/usr/bin/node /var/lib/docker/overlay2/08e9e8e2fedc07314a0fc0facff7fc8e5fc7d43fa6e57c3a54b7fb1c141dc283/diff/usr/bin/node /var/lib/docker/overlay2/deb9840ca10888b27d52a61c5cade81e84b9785c0ec09c35f8a6c6c54248ab6d/diff/usr/bin/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653428182488-0.19533838598503928/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653429291094-0.5629078598158002/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653428182499-0.6750280283401504/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653429290169-0.9650387625910679/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653429291105-0.6823192322314524/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/diff/tmp/yarn--1653428181552-0.5641164252686381/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653428182488-0.19533838598503928/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653429291094-0.5629078598158002/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653428182499-0.6750280283401504/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653429290169-0.9650387625910679/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653429291105-0.6823192322314524/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/tmp/yarn--1653428181552-0.5641164252686381/node /var/lib/docker/overlay2/2742c13be1461a17bc0e58d36f80c5b3d5f40be4937d2b1a539a71dd416be213/merged/usr/local/bin/node /var/lib/docker/overlay2/9d4352db6ebf24bcf5611545e6c2e901b7b6c9c9beb6ff027b6376935b7c35ba/diff/usr/bin/node /var/lib/docker/overlay2/7d84fea44f0775569be90cb1a9a47e7902239270f59b669a1a49e338148fac35/diff/usr/bin/node /var/lib/docker/overlay2/7d84fea44f0775569be90cb1a9a47e7902239270f59b669a1a49e338148fac35/merged/usr/bin/node /var/lib/docker/overlay2/08b82a8278f8222f4c303881933d42e2185f4ad780f67439b7ec9f63783840fa/diff/usr/bin/node /var/lib/docker/overlay2/52584ce1c2b8b690f298c177f4a5e6168eec95757e8f68b800a303eead539312/diff/usr/bin/node /var/lib/docker/overlay2/b3def3e46123572a830b313da9811c6a63c5d6f791863868de44badfe4437b8f/diff/usr/bin/node /var/lib/docker/overlay2/b3def3e46123572a830b313da9811c6a63c5d6f791863868de44badfe4437b8f/merged/usr/bin/node /var/lib/docker/overlay2/f7c4e9361d8b6dc1a3658a80c132c07604cd64081061bc1969d000d2b2f3cb7e/diff/usr/bin/node /var/lib/docker/overlay2/a3e3a193118c53e2514a4cce05c811e60d9d254686adb2b156dc0eb343adb98d/diff/usr/bin/node /var/lib/docker/overlay2/f6b4ab07714089bfd62e7a2eb11bb672e7bddd80dedf36f42155208bacc22be7/diff/usr/bin/node /var/lib/docker/overlay2/bb1d04fdce47f2a45685ff912cd2a8b4b964a3a666827bb4a676c8f6998718cc/diff/usr/local/bin/node /var/lib/docker/overlay2/521adf00f0bd3b2470b68a17ffdf267d65dde961e929143e63f053211a849c57/diff/usr/bin/node /var/lib/docker/overlay2/cd45248e0bdb801ec3ad7b5b16c9cdd02f4a903ffe2f738542ff38ef1c2a7e4b/diff/usr/bin/node /home/olinuc/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/node /home/olinuc/.vscode-server/bin/e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff/node /home/olinuc/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/node /home/olinuc/.vscode-server/bin/da76f93349a72022ca4670c1b84860304616aaa2/node /home/olinuc/.vscode-server/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a/node /usr/local/n/versions/node/16.16.0/bin/node /usr/local/bin/node

3 of the 5 vscode-nodes are version v16.13.2
2 of the 5 vscode-nodes are version v14.16.0
the active node and the preserved n version of node is v16.16.0

is there a command that i can execute in a certan path to see which wrong environment node uses?

@connor4312
Copy link
Member

If you have your index.js do something like console.log(JSON.stringify(process.env)), I'm curious to see the result

@oweitman
Copy link
Author

oweitman commented Oct 5, 2022

here it is.
but remember, if i start the debugging from chrome developer tools, the debugging works.
see video in message from 20 Jul.

the /home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7/node was isntalled right now und has the version v16.14.2

{
    "MAIL": "/var/mail/olinuc",
    "USER": "olinuc",
    "SSH_CLIENT": "192.168.1.226 51001 22",
    "XDG_SESSION_TYPE": "tty",
    "SHLVL": "0",
    "HOME": "/home/olinuc",
    "OLDPWD": "/home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7",
    "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus",
    "LOGNAME": "olinuc",
    "_": "/home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7/node",
    "XDG_SESSION_CLASS": "user",
    "XDG_SESSION_ID": "63399",
    "PATH": "/home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7/bin/remote-cli:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games",
    "XDG_RUNTIME_DIR": "/run/user/1000",
    "LANG": "de_DE.UTF-8",
    "SHELL": "/bin/bash",
    "PWD": "/home/olinuc",
    "SSH_CONNECTION": "192.168.1.226 51001 192.168.1.61 22",
    "LS_COLORS": "",
    "BROWSER": "/home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7/bin/helpers/browser.sh",
    "NODE_OPTIONS": "--require /home/olinuc/.vscode-server/bin/74b1f979648cc44d385a2286793c226e611f59e7/extensions/ms-vscode.js-debug/src/bootloader.bundle.js --inspect-publish-uid=http",
    "VSCODE_INSPECTOR_OPTIONS": "{\"inspectorIpc\":\"/tmp/node-cdp.32033-1.sock\",\"deferredMode\":false,\"waitForDebugger\":\"\",\"execPath\":\"/usr/local/bin/node\",\"onlyEntrypoint\":false,\"autoAttachMode\":\"always\",\"mandatePortTracking\":true,\"fileCallback\":\"/tmp/node-debug-callback-8ca00b62cf11d4d5\"}"
}

@connor4312
Copy link
Member

That looks correct, but it seems our NODE_OPTIONS are not getting respected. Do you have capabilities set on the Node.js binary? This can cause issues nodejs/node#37588

remember, if i start the debugging from chrome developer tools, the debugging works

Yes, it looks like the issue is Node.js is not parsing the environment variables that are used to force it into debug mode. Launching the program with --inspect-brk and attaching to it is an alternative way to enter debug mode.

@oweitman
Copy link
Author

oweitman commented Oct 5, 2022

i am not aware, if i set it long time ago

if i check the capabilities
olinuc@olinuc:~$ sudo getcap /usr/local/bin/node
/usr/local/bin/node = cap_net_bind_service,cap_net_admin,cap_net_raw+eip

I only had to set capabilities for some docker containers, but normally I didn't have to use them
i dont understand the extension +eip in the capabilitie cap_net_raw

on first scan of
https://man7.org/linux/man-pages/man7/capabilities.7.html
i didnt get it, i have to read it in detail.

should i change it? to which?

@connor4312
Copy link
Member

You can run sudo setcap -r $(which node) to unset any capabilities that were previously set

@oweitman
Copy link
Author

oweitman commented Oct 5, 2022

thank you. that was the solution

@oweitman oweitman closed this as completed Oct 5, 2022
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 info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants