Skip to content

Attaching python debugger fails in rarely #179

Open
@cedric-fauth

Description

@cedric-fauth

Type: Bug

Behaviour

Expected vs. Actual

The following launch config sometimes fails but port is open and the debugee process is waiting for the debugger to attach:
image

        {
            "name": "Manual: Attach debugger",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "127.0.0.1",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "."
                }
            ],
            "justMyCode": false,
            "logToFile": true,
            "redirectOutput": true,
            "django": true
        },

Steps to reproduce:

  1. Cannot be reproduced even not by me it just happens sometimes when intensively using a python process and the debugger.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.2
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-12-05 15:15:02.885 [error] Cannot read properties of undefined (reading 'defaultEncoding'): TypeError: Cannot read properties of undefined (reading 'defaultEncoding')
    at _write (node:internal/streams/writable:294:24)
    at Writable.write (node:internal/streams/writable:337:10)
    at u.log (/home/vscode/.vscode-server/extensions/ms-python.python-2023.20.0/out/client/extension.js:2:345214)
    at u.onWillStopSession (/home/vscode/.vscode-server/extensions/ms-python.python-2023.20.0/out/client/extension.js:2:344975)
    at /vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:122:386
    at Array.forEach (<anonymous>)
    at m.onWillStopSession (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:122:353)
    at a.$stopDASession (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:121:9917)
    at i.N (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:117:10813)
    at i.M (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:117:10579)
    at i.H (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:117:9660)
    at i.G (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:117:8736)
    at n.value (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:117:7566)
    at m.w (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at m.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at v.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:13940)
    at n.value (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:136:7901)
    at m.w (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at m.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at v.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:13940)
    at s.z (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:17005)
    at n.value (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:16410)
    at m.w (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at m.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at n.acceptChunk (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:11714)
    at n.value (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:79:11001)
    at m.w (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at m.fire (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at m.u (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:133:19093)
    at m.acceptFrame (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:133:18899)
    at a.l (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:133:17532)
    at /vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:133:14879
    at Socket.p (/vscode/vscode-server/bin/linux-x64/8b617bd08fd9e3fc94d14adb8d358b56e3f72314/out/vs/workbench/api/node/extensionHostProcess.js:133:12793)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
2023-12-05 15:15:12.404 [error] Error while getting the engine for the version 0.6.0. Server returned 404```

</p>
</details>

<details>

<summary>User Settings</summary>

<p>

languageServer: "Pylance"

testing
• pytestEnabled: true


</p>
</details>


Extension version: 2023.20.0
VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Remote OS version: Linux x64 5.15.133.1-microsoft-standard-WSL2


<!-- generated by issue reporter -->

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugneeds spike

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions