Skip to content

Attach using Process ID times out waiting for debugger #147221

@richbobo

Description

@richbobo

Issue Type: Bug

Python Intellisense (Pylance) plugin Version 2022.4.1
-- Unable to attach to Python Process ID:
"Timed out waiting for debug server to connect."
"ImportError: No module named _thread"

-- Was able to get it working again by reverting back to plugin Version 2022.2.1924087327

Full debugpy.adapter-26944.log output below:

I+00000.119: Windows-10-10.0.18362 AMD64
CPython 2.7.16 (64-bit)
debugpy 1.6.0

I+00000.124: debugpy.adapter startup environment:

         System paths:
             sys.prefix: C:\Python27
             sys.base_prefix: <missing>
             sys.real_prefix: <missing>
             site.getsitepackages(): C:\Python27
                                     C:\Python27\lib\site-packages
             site.getusersitepackages(): C:\Users\rich.bobo\AppData\Roaming\Python\Python27\site-packages
             sys.path (site-packages): C:\Python27\lib\site-packages
                                       C:\Users\rich.bobo\AppData\Roaming\Python\Python27\site-packages
                                       \\GFS\thr3dcgi_config\Apps\Python27\Lib\site-packages
             sysconfig.get_path('stdlib'): C:\Python27\Lib
             sysconfig.get_path('platstdlib'): C:\Python27\Lib
             sysconfig.get_path('purelib'): C:\Python27\Lib\site-packages
             sysconfig.get_path('platlib'): C:\Python27\Lib\site-packages
             sysconfig.get_path('include'): C:\Python27\Include
             sysconfig.get_path('scripts'): C:\Python27\Scripts
             sysconfig.get_path('data'): C:\Python27
             os.__file__: C:\Python27\lib\os.pyc
             threading.__file__: C:\Python27\lib\threading.pyc

I+00000.127: Listening for incoming Client connections on 127.0.0.1:57858...

I+00000.127: Connecting to client over stdio...

D+00000.128: Starting message loop for channel Client[1]

D+00000.130: Client[1] --> {
"seq": 1,
"type": "request",
"command": "initialize",
"arguments": {
"supportsProgressReporting": true,
"adapterID": "python",
"locale": "en-us",
"supportsRunInTerminalRequest": true,
"pathFormat": "path",
"supportsInvalidatedEvent": true,
"clientID": "vscode",
"supportsVariableType": true,
"supportsVariablePaging": true,
"supportsMemoryReferences": true,
"linesStartAt1": true,
"columnsStartAt1": true,
"clientName": "Visual Studio Code"
}
}

D+00000.130: Client[1] <-- {
"seq": 1,
"type": "event",
"event": "output",
"body": {
"category": "telemetry",
"output": "ptvsd",
"data": {
"packageVersion": "1.6.0"
}
}
}

D+00000.132: Client[1] <-- {
"seq": 2,
"type": "event",
"event": "output",
"body": {
"category": "telemetry",
"output": "debugpy",
"data": {
"packageVersion": "1.6.0"
}
}
}

D+00000.134: /handling #1 request "initialize" from Client[1]/
Capabilities: {
"supportsVariableType": true,
"supportsRunInTerminalRequest": true,
"supportsVariablePaging": true,
"supportsMemoryReferences": true
}

D+00000.135: /handling #1 request "initialize" from Client[1]/
Expectations: {
"locale": "en-us",
"linesStartAt1": true,
"columnsStartAt1": true,
"pathFormat": "path"
}

D+00000.136: /handling #1 request "initialize" from Client[1]/
Client[1] <-- {
"seq": 3,
"type": "response",
"request_seq": 1,
"success": true,
"command": "initialize",
"body": {
"supportsModulesRequest": true,
"supportsConfigurationDoneRequest": true,
"supportsDelayedStackTraceLoading": true,
"supportsDebuggerProperties": true,
"supportsHitConditionalBreakpoints": true,
"supportsSetExpression": true,
"supportsGotoTargetsRequest": true,
"supportsSetVariable": true,
"supportsLogPoints": true,
"supportsCompletionsRequest": true,
"exceptionBreakpointFilters": [
{
"filter": "raised",
"default": false,
"description": "Break whenever any exception is raised.",
"label": "Raised Exceptions"
},
{
"filter": "uncaught",
"default": true,
"description": "Break when the process is exiting due to unhandled exception.",
"label": "Uncaught Exceptions"
},
{
"filter": "userUnhandled",
"default": false,
"description": "Break when exception escapes into library code.",
"label": "User Uncaught Exceptions"
}
],
"supportsExceptionInfoRequest": true,
"supportsFunctionBreakpoints": true,
"supportsValueFormattingOptions": true,
"supportsEvaluateForHovers": true,
"supportsExceptionOptions": true,
"supportsTerminateDebuggee": true,
"supportsStepInTargetsRequest": true,
"supportsConditionalBreakpoints": true,
"supportsClipboardContext": true
}
}

D+00000.155: Client[1] --> {
"seq": 2,
"type": "request",
"command": "attach",
"arguments": {
"processId": "35540",
"__configurationTarget": 5,
"pathMappings": [
{
"remoteRoot": "t:\configs\dev_rich_labelfacts",
"localRoot": "t:\configs\dev_rich_labelfacts"
}
],
"name": "Python: Attach using Process Id",
"__sessionId": "3ad675f1-d6c8-4423-b287-acaf79d83743",
"logToFile": true,
"request": "attach",
"debugOptions": [
"RedirectOutput",
"FixFilePathCase",
"WindowsClient",
"ShowReturnValue"
],
"host": "localhost",
"workspaceFolder": "t:\configs\dev_rich_labelfacts",
"showReturnValue": true,
"type": "python",
"justMyCode": true
}
}

I+00000.155: /handling #2 request "attach" from Client[1]/
Listening for incoming Server connections on 127.0.0.1:57859...

I+00000.156: /handling #2 request "attach" from Client[1]/
Spawning attach-to-PID debugger injector: ['C:\Python27\python.exe', u'c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy', u'--connect', u'127.0.0.1:57859', u'--adapter-access-token', '3f06102c2b739b75293c9dde69b8e3cf7691e1f86b1a6e996c78609b388c59f2', u'--pid', '35540']

D+00000.161: /handling #2 request "attach" from Client[1]/
Client[1] <-- {
"seq": 4,
"type": "event",
"event": "debugpyWaitingForServer",
"body": {
"host": "127.0.0.1",
"port": 57859
}
}

I+00000.162: /handling #2 request "attach" from Client[1]/
Session[1] waiting for connection from debug server...

I+00001.430: Injector[PID=35540] output:
Traceback (most recent call last):

I+00001.431: Injector[PID=35540] output:
File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main

I+00001.431: Injector[PID=35540] output:
"main", fname, loader, pkg_name)

I+00001.431: Injector[PID=35540] output:
File "C:\Python27\lib\runpy.py", line 72, in _run_code

I+00001.431: Injector[PID=35540] output:
exec code in run_globals

I+00001.432: Injector[PID=35540] output:
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy_main_.py", line 43, in

I+00001.432: Injector[PID=35540] output:
from debugpy.server import cli

I+00001.432: Injector[PID=35540] output:
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy/../debugpy\server_init_.py", line 9, in

I+00001.432: Injector[PID=35540] output:
import debugpy._vendored.force_pydevd # noqa

I+00001.432: Injector[PID=35540] output:
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy/../debugpy_vendored\force_pydevd.py", line 37, in

I+00001.433: Injector[PID=35540] output:
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')

I+00001.433: Injector[PID=35540] output:
File "C:\Python27\lib\importlib_init_.py", line 37, in import_module

I+00001.433: Injector[PID=35540] output:
import(name)

I+00001.433: Injector[PID=35540] output:
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_constants.py", line 362, in

I+00001.433: Injector[PID=35540] output:
from _pydev_bundle._pydev_saved_modules import thread, threading

I+00001.434: Injector[PID=35540] output:
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy_vendored\pydevd_pydev_bundle_pydev_saved_modules.py", line 94, in

I+00001.434: Injector[PID=35540] output:
import _thread as thread; verify_shadowed.check(thread, ['start_new_thread', 'start_new', 'allocate_lock'])

I+00001.434: Injector[PID=35540] output:
ImportError: No module named _thread

I+00001.434: Injector[PID=35540] exited.

I+00015.163: All debug servers disconnected; waiting for remaining sessions...

E+00015.169: /handling #2 request "attach" from Client[1]/
Traceback (most recent call last):
File "c:\Users\rich.bobo.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 1062, in init
raise self
MessageHandlingError: Timed out waiting for debug server to connect.

         Stack where logged:
           File "C:\Python27\lib\threading.py", line 774, in __bootstrap
             self.__bootstrap_inner()
           File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
             self.run()
           File "C:\Python27\lib\threading.py", line 754, in run
             self.__target(*self.__args, **self.__kwargs)
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 1510, in _run_handlers
             handler()
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 747, in _handle
             result = handler(self)
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\adapter\components.py", line 95, in lock_and_handle
             return f(self, message)
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\adapter\clients.py", line 210, in handle
             f(self, request)
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\adapter\clients.py", line 532, in attach_request
             sub_pid,
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 560, in cant_handle
             return self.error(MessageHandlingError, *args, **kwargs)
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 546, in error
             exc = exc_type(reason, self, silent)  # will log it
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\messaging.py", line 1064, in __init__
             log.swallow_exception()
           File "c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\common\log.py", line 218, in swallow_exception
             _exception(format_string, *args, **kwargs)

D+00015.170: /handling #2 request "attach" from Client[1]/
Client[1] <-- {
"seq": 5,
"type": "response",
"request_seq": 2,
"success": false,
"command": "attach",
"message": "Timed out waiting for debug server to connect."
}

E+00015.173: /handling #2 request "attach" from Client[1]/
Handler 'handle' (file u'c:\Users\rich.bobo\.vscode\extensions\ms-python.python-2022.5.10981002\pythonFiles\lib\python\debugpy\adapter/../../debugpy\adapter\components.py', line 91)
couldn't handle #2 request "attach" from Client[1]:
Timed out waiting for debug server to connect.

D+00015.180: Client[1] --> {
"seq": 3,
"type": "request",
"command": "disconnect",
"arguments": {
"restart": false
}
}

I+00015.181: /handling #3 request "disconnect" from Client[1]/
client requested "disconnect"; finalizing Session[1].

D+00015.181: /handling #3 request "disconnect" from Client[1]/
Client[1] <-- {
"seq": 6,
"type": "event",
"event": "terminated"
}

I+00015.181: /handling #3 request "disconnect" from Client[1]/
Session[1] finalized.

D+00015.182: /handling #3 request "disconnect" from Client[1]/
Client[1] <-- {
"seq": 7,
"type": "response",
"request_seq": 3,
"success": true,
"command": "disconnect"
}

VS Code version: Code 1.66.1 (8dfae7a, 2022-04-06T14:50:12.141Z)
OS version: Windows_NT x64 10.0.18362
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2697A v4 @ 2.60GHz (64 x 2594)
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
oop_rasterization: enabled
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) 63.92GB (35.36GB free)
Process Argv --crash-reporter-id ac5fa1a5-26a7-418c-93a8-0122a4cf66c2
Screen Reader no
VM 0%
Extensions (35)
Extension Author (truncated) Version
numbered-bookmarks ale 8.2.0
vscode-custom-css be5 6.0.2
vscode-to-photoshop bia 0.0.3
better-toml bun 0.3.2
vscode-markdownlint Dav 0.47.0
vscode-eslint dba 2.2.2
githistory don 0.6.19
xml Dot 2.5.1
gitlens eam 12.0.5
vscode-html-css ecm 1.11.0
python-ultisnippets eli 2.7.0
LogFileHighlighter emi 2.15.0
pythonsnippets frh 1.0.2
vscode-pull-request-github Git 0.40.0
vsc-python-indent Kev 1.15.0
MagicPython mag 1.1.0
git-graph mhu 1.30.0
gitignore mic 1.0.1
python ms- 2022.2.1924087327
vscode-pylance ms- 2022.4.0
jupyter ms- 2022.3.1000901801
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.6
vscode-gitignore-generator pio 1.0.3
vscode-commons red 0.0.6
vscode-yaml red 1.6.0
mel sat 0.1.2
vscode-smoothtype spi 1.2.0
open-in-browser tec 2.0.0
simple-rst tro 1.5.2
vscode-todo-highlight way 1.0.5
markdown-pdf yza 1.4.4
markdown-all-in-one yzh 3.4.0
pyqt-integration zho 0.2.0
material-theme zhu 3.13.20

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
pynewfile477:30463512

Metadata

Metadata

Assignees

No one assigned

    Labels

    *caused-by-extensionIssue identified to be caused by an extension

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions