Skip to content

Stack crash when trying to stop on an PyTest breakpoint #1747

@WibblyGhost

Description

@WibblyGhost

When running a debug point on a pytest function, when the executor enters the breakpoint, it immediately crashes.

Found with debugpy == 2024.12.0
Version: 1.95.3 (system setup)
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19045

{
            "name": "Python: Debug Tests",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "purpose": ["debug-test"],
            "console": "integratedTerminal",
            "justMyCode": false,
            "env": {
                "PYTEST_ADDOPTS": "--no-cov"
            }
        }

Trying to run this test on python 3.12
pip list
Package Version


aiofiles 24.1.0
aiohappyeyeballs 2.4.0
aiohttp 3.11.7
aiosignal 1.3.1
astroid 3.3.5
attrs 24.2.0
black 24.10.0
certifi 2024.7.4
cfgv 3.4.0
charset-normalizer 3.3.2
click 8.1.7
colorama 0.4.6
construct 2.10.70
coverage 7.6.1
dill 0.3.8
distlib 0.3.8
Faker 33.0.0
filelock 3.15.4
flake8 7.1.1
frozenlist 1.4.1
identify 2.6.0
idna 3.8
iniconfig 2.0.0
isort 5.13.2
mccabe 0.7.0
mock 5.1.0
multidict 6.0.5
mypy 1.13.0
mypy-extensions 1.0.0
nodeenv 1.9.1
p25codecs 2.6.2
p25simulatorcommon 1.2.2
packaging 24.1
pathspec 0.12.1
pip 24.3.1
platformdirs 4.2.2
pluggy 1.5.0
pre_commit 4.0.1
prettier 0.0.7
progress 1.6
propcache 0.2.0
pycodestyle 2.12.1
pyflakes 3.2.0
pylint 3.3.1
pytest 8.3.3
pytest-asyncio 0.24.0
pytest-cov 6.0.0
pytest-mock 3.14.0
pytest-timeout 2.3.1
python-dateutil 2.9.0.post0
PyYAML 6.0.2
reedsolo 1.7.0
requests 2.32.3
scapy 2.5.0
six 1.16.0
termcolor 2.3.0
tomlkit 0.13.2
tqdm 4.67.1
types-aiofiles 24.1.0.20240626
types-requests 2.32.0.20241016
typing_extensions 4.12.2
urllib3 2.2.2
virtualenv 20.26.3
vulture 2.13
yarl 1.18.0
yaspin 3.0.2

@mark.asyncio
async def test_send_retries_on_too_many_requests(
    mocker: MockerFixture,
    wui_fixture: AsyncWuiClient,
    request_fixture: AsyncMock,
    caplog: LogCaptureFixture,
) -> None:
    # Define
    async with wui_fixture as client:
        kwargs_ = wui_fixture._create_kwargs(target_url=TEST_TARGET_URL)  # Already been tested
    response_1 = ResponseGenerator(status_code=429, method=TEST_GET).prepare()
    response_2 = ResponseGenerator(status_code=200, method=TEST_GET).prepare()

    # Setup/Mock
    caplog.set_level(WARNING)
    sleep_ = mocker.patch("src.async_wui.base.wui_client.sleep", return_value=mocker.async_stub())  <---- breakpoint set
taitnet@Zac-Dev:~/Programming/wui_clients$  /usr/bin/env /home/taitnet/Programming/wui_clients/.venv3/bin/python /home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 39941 -- /home/taitnet/.vscode-server/extensions/ms-python.python-2024.20.0-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/home/taitnet/Programming/wui_clients --capture=no 
Running pytest with args: ['-p', 'vscode_pytest', '--rootdir=/home/taitnet/Programming/wui_clients', '--capture=no', '/home/taitnet/Programming/wui_clients/tests/async_wui/base/test_async_wui_client.py::test_send_retries_on_too_many_requests']
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/taitnet/Programming/wui_clients
configfile: pyproject.toml
plugins: timeout-2.3.1, mock-3.14.0, cov-6.0.0, asyncio-0.24.0, Faker-33.0.0
timeout: 0.25s
timeout method: signal
timeout func_only: False
asyncio: mode=Mode.STRICT, default_loop_scope=function
collected 1 item

tests/async_wui/base/test_async_wui_client.py ~~~~~~~~~~~~~~~~~~~~~ Stack of <unknown> (132507030783680) ~~~~~~~~~~~~~~~~~~~~~
  File "/usr/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 53, in run
    self._on_run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 325, in _on_run
    self._wait_event.wait(TIMEOUT_SLOW)
  File "/usr/lib/python3.12/threading.py", line 655, in wait
    signaled = self._cond.wait(timeout)
  File "/usr/lib/python3.12/threading.py", line 359, in wait
    gotit = waiter.acquire(True, timeout)
~~~~~~~~~~~~~~~~~~~~~ Stack of <unknown> (132507041269440) ~~~~~~~~~~~~~~~~~~~~~
  File "/usr/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 53, in run
    self._on_run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 280, in _on_run
    self._py_db_command_thread_event.wait(TIMEOUT_SLOW)
  File "/usr/lib/python3.12/threading.py", line 655, in wait
    signaled = self._cond.wait(timeout)
  File "/usr/lib/python3.12/threading.py", line 359, in wait
    gotit = waiter.acquire(True, timeout)
~~~~~~~~~~~~~~~~~~~~~ Stack of <unknown> (132507051755200) ~~~~~~~~~~~~~~~~~~~~~
  File "/usr/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 53, in run
    self._on_run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 245, in _on_run
    line = self._read_line()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 227, in _read_line
    r = self.sock.recv(1024)
~~~~~~~~~~~~~~~~~~~~~ Stack of <unknown> (132507062240960) ~~~~~~~~~~~~~~~~~~~~~
  File "/usr/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 53, in run
    self._on_run()
  File "/home/taitnet/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 390, in _on_run
    cmd = self._cmd_queue.get(True, 0.1)
  File "/usr/lib/python3.12/queue.py", line 180, in get
    self.not_empty.wait(remaining)
  File "/usr/lib/python3.12/threading.py", line 359, in wait
    gotit = waiter.acquire(True, timeout)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions