microsoft / vscode-black-formatter

Formatting support for Python using the Black formatter
https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
MIT License
144 stars 34 forks source link

Black Formatter client: couldn't create connection to server: listen EACCES: permission denied #448

Closed ischurov closed 5 months ago

ischurov commented 5 months ago

Type: Bug

I am using Remote Tunnels to access my remote Linux system. When I start the Black Formatter extension, it says that it cannot connect to the server. The logs say that there some kind of permission issue: "Error: listen EACCES: permission denied", see below. I tried deleting ~/.vscode-server, as suggested here, but it doesn't help. The ownership of the folder /run/user/42759/ mentioned in the log seem to be right:

ischurov@cn84:/run/user/42759$ ls -lhd .
drwx------ 4 ischurov ischurov 120 Feb  5 13:46 .
ischurov@cn84:/run/user/42759$ ls -lh
total 0
srw-rw-rw- 1 ischurov ischurov   0 Feb  5 13:46 bus
drwx------ 2 ischurov ischurov 140 Feb  5 13:46 gnupg
srw-rw-rw- 1 ischurov ischurov   0 Feb  5 13:46 pk-debconf-socket
drwxr-xr-x 5 ischurov ischurov 140 Feb  5 13:46 systemd

Here are the logs

2024-02-05 14:38:31.671 [info] Python extension loaded
2024-02-05 14:38:31.671 [info] Interpreter from ms-python.python extension for /home/ischurov/tcm10/frustrations-eda: /nix/store/1imrsc7j1b5kbglxsnvnmkjyv0sd1kl1-python3-3.11.6-env/bin/python
2024-02-05 14:38:31.671 [info] No interpreter found from setting black-formatter.interpreter
2024-02-05 14:38:31.671 [info] Getting interpreter from ms-python.python extension for workspace /home/ischurov/tcm10/frustrations-eda
2024-02-05 14:38:31.671 [info] Interpreter from ms-python.python extension for /home/ischurov/tcm10/frustrations-eda: /nix/store/1imrsc7j1b5kbglxsnvnmkjyv0sd1kl1-python3-3.11.6-env/bin/python
2024-02-05 14:38:31.671 [info] Server run command: /nix/store/1imrsc7j1b5kbglxsnvnmkjyv0sd1kl1-python3-3.11.6-env/bin/python /home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/bundled/tool/lsp_server.py
2024-02-05 14:38:31.671 [info] Server: Start requested.
2024-02-05 14:38:31.671 [info] [Error - 2:38:29 PM] Black Formatter client: couldn't create connection to server.
2024-02-05 14:38:31.671 [info] Error: listen EACCES: permission denied /run/user/42759/vscode-ipc-32c3e14e337084543ad39d91f47630914bbc3d2f12.sock
    at Server.setupListenHandle [as _listen2] (node:net:1734:21)
    at listenInCluster (node:net:1799:12)
    at Server.listen (node:net:1898:5)
    at /home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:118326
    at new Promise (<anonymous>)
    at t.createClientPipeTransport (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:118217)
    at /home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:314945
    at async w.createConnection (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:147022)
    at async w.start (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:137476)
    at async t.restartServer (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:56186)
    at async o (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:66639)
    at async g.value (/home/ischurov/.vscode-server/extensions/ms-python.black-formatter-2024.1.10361006/dist/extension.js:1:66743)
2024-02-05 14:38:31.671 [error] Server: Start failed: Error: listen EACCES: permission denied /run/user/42759/vscode-ipc-32c3e14e337084543ad39d91f47630914bbc3d2f12.sock

Extension version: 2024.0.0 VS Code version: Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937, 2024-01-31T10:29:15.765Z) OS version: Darwin x64 22.1.0 Modes: Remote OS version: Linux x64 5.15.0-88-generic

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz (8 x 1400)| |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_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|4, 4, 7| |Memory (System)|16.00GB (0.22GB free)| |Process Argv|--crash-reporter-id 6268c79f-ba03-42d2-bf4d-cd2dfec6306c| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|cn24| |OS|Linux x64 5.15.0-88-generic| |CPUs|Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz (16 x 1890)| |Memory (System)|31.31GB (28.75GB free)| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 0bi6i642:30951795 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 dsvsc019b:30953937 3ef8e399:30949928 ```
karthiknadig commented 5 months ago

Added a setting to control the transport type: https://github.com/microsoft/vscode-black-formatter/pull/449 . You don't need to do anything, the pipe mode was supposed to be used in special cases.

We will push a fix for this soon.

karthiknadig commented 5 months ago

The fix will be out for this in the next pre-release.