eclipse-theia/theia

Python VS extension: debug fails when Debug console is already opened

Open

#7,141 opened on Feb 12, 2020

View on GitHub
 (11 comments) (0 reactions) (1 assignee)TypeScript (2,478 forks)batch import
bughelp wantedpythonvscode

Repository metrics

Stars
 (18,676 stars)
PR merge metrics
 (Avg merge 15d 4h) (75 merged PRs in 30d)

Description

Description

I found an issue when debugging in Theia v0.15.0 with Python VS extension. After version 2019.9.34911 there is an error when starting a debug session with the "Python Debug Console" already open.

Reproduction Steps

Python VS extension : 2020.1.58038

OS and Theia version: Ubuntu Disco and Theia v0.15.0. Installation with this Dockerfile. Using the following package.json

Diagnostics: In the Python Debug console:

~/workspace# /usr/bin/python /tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/launcher /root/workspace/example.py
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
 "__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
 exec(code, run_globals)
File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/launcher/__main__.py", line 80, in <module>
 main()
File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/launcher/__main__.py", line 42, in main
 launcher.connect(launcher_port)
File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/launcher/../../ptvsd/launcher/__init__.py", line 27, in connect
 sock.connect(("127.0.0.1", launcher_port))
ConnectionRefusedError: [Errno 111] Connection refused

In the backend:

root ERROR [hosted-plugin: 111] E+00010.052: /handling #2 request "launch" from IDE[1]/
          Handler 'IDE._start_message_handler.<locals>.handle' (file '/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/components.py', line 160)
          couldn't handle #2 request "launch" from IDE[1]:
          Traceback (most recent call last):
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/common/messaging.py", line 766, in _handle
              result = handler(self)
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/components.py", line 95, in lock_and_handle
              return f(self, message)
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/ide.py", line 176, in handle
              f(self, request)
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/ide.py", line 278, in launch_request
              self.session, request, sudo, args, console, console_title
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/launchers.py", line 115, in spawn_debuggee
              spawn_launcher()
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/launchers.py", line 98, in spawn_launcher
              "env": env,
            File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
              next(self.gen)
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/adapter/sessions.py", line 163, in _accept_connection_from
              sock, (other_host, other_port) = listener.accept()
            File "/usr/lib/python3.7/socket.py", line 212, in accept
              fd, addr = self._accept()
          socket.timeout: timed out
          Stack where logged:
            File "/usr/lib/python3.7/threading.py", line 885, in _bootstrap
              self._bootstrap_inner()
            File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
              self.run()
            File "/usr/lib/python3.7/threading.py", line 865, in run
              self._target(*self._args, **self._kwargs)
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/common/messaging.py", line 1523, in _run_handlers
              handler()
            File "/tmp/vscode-unpacked/ms-python.python-latest.vsix/extension/pythonFiles/lib/python/new_ptvsd/wheels/ptvsd/adapter/../../ptvsd/common/messaging.py", line 812, in _handle
              self.describe(),

Contributor guide