Skip to content

[non-deterministic] is_client_connected() crashes with KeyError: '_pydevd_bundle.pydevd_comm_constants' #2020

@francescomikulis

Description

@francescomikulis

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.20
  • OS and version: macOS 26.3 + uv / .venv
  • Python version: 3.13
  • Using Cursor

Actual behavior

Crash during parallel testing on github runner (using pytest xdist) - the code calls:

is_client_connected()

Backtrace:

../../../.venv/lib/python3.13/site-packages/debugpy/public_api.py:44: in wrapper
    from debugpy.server import api
../../../.venv/lib/python3.13/site-packages/debugpy/server/__init__.py:7: in <module>
    import debugpy._vendored.force_pydevd  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.venv/lib/python3.13/site-packages/debugpy/_vendored/force_pydevd.py:44: in <module>
    preimport('pydevd', [
../../../.venv/lib/python3.13/site-packages/debugpy/_vendored/__init__.py:126: in preimport
    import_module(name)
/home/runner/.local/share/uv/python/cpython-3.13.11-linux-x86_64-gnu/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.venv/lib/python3.13/site-packages/debugpy/_vendored/pydevd/pydevd.py:39: in <module>
    import pydevd_file_utils
../../../.venv/lib/python3.13/site-packages/debugpy/_vendored/pydevd/pydevd_file_utils.py:47: in <module>
    from _pydevd_bundle.pydevd_comm_constants import file_system_encoding, filesystem_encoding_is_utf8
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

spec = ModuleSpec(name='_pydevd_bundle.pydevd_comm_constants', loader=<_frozen_importlib_external.SourceFileLoader object at ...venv/lib/python3.13/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm_constants.py')

>   ???
E   KeyError: '_pydevd_bundle.pydevd_comm_constants'

<frozen importlib._bootstrap>:946: KeyError

Expected behavior

No crash.

Steps to reproduce:

Unable to reproduce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions