VS Code randomly starts listening on high port on 0.0.0.0

Viewed 49

VS code often starts listening on a random high port on all interfaces.

$ lsb_release -d
Description:    Ubuntu 22.04 LTS
$ code --version
1.67.2
c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
x64
$ sudo ss -ltpn | grep code
LISTEN 0      511                *:33333            *:*    users:(("code",pid=75602,fd=52))  

In VS code developer tools console:

CRITI Extension 'ms-vsliveshare.vsliveshare' wants API proposal 'notebookDocumentEvents' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
log.ts:313
ERR UnboundLocalError: local variable 'start_index' referenced before assignment: Error: UnboundLocalError: local variable 'start_index' referenced before assignment
    at /home/user/.vscode/extensions/ms-python.python-2022.8.0/out/client/extension.js:2:2107873
    at /home/user/.vscode/extensions/ms-python.python-2022.8.0/out/client/extension.js:2:2108167
    at Immediate.<anonymous> (/home/user/.vscode/extensions/ms-python.python-2022.8.0/out/client/extension.js:2:2108529)
    at processImmediate (node:internal/timers:464:21)
log.ts:313
ERR Error: File not found
    at g.handleSetInputError (vscode-file://vscode….main.js:2701:95592)
    at async g.setInput (vscode-file://vscode….main.js:2701:94832)
    at async doSetInput (vscode-file://vscode…p.main.js:2699:6429)
    at async doOpenEditor (vscode-file://vscode…p.main.js:2699:4791)
    at async d.openEditor (vscode-file://vscode…p.main.js:2699:3783)
    at async vscode-file://vscode….main.js:2906:16950
    at async bi.openAnything (vscode-file://vscode….main.js:2712:17542)

I have not been able to reproduce whenever the Microsoft Python extension (Python v2022.8.0) was disabled, so it might be related to that. There is an error in the console related to ms-python, but I do not immediately see how it would lead to a port being opened, especially not on 0.0.0.0.

The following shows nothing:

$ sudo tcpdump -i any port 33333

The question is what causes this port to be opened (and how to avoid this).

In the process explorer of VS code it shows that the process that opened the port is 'extensionHost'.

0 Answers
Related