Skip to content

test_attach_pid_client is flaky #311

Closed

Description

@int19h

Fails often on macOS, and occasionally on Windows. Needs to be disabled until it's investigated and fixed.

Might be related to #166.

Activity

  1. added
    test issue
    on Jun 24, 2020
  2. removed their assignment
    on Sep 27, 2022
  3. rchiodo commented on Jul 26, 2024

    @rchiodo
    Contributor

    The reason this fails on windows is because the python.exe used by tox is not attachable. The python.exe doesn't load the CPython dll, it looks like it's a statically linked version of python.

    I dumped the modules loaded into the debuggee when it was failing and I got this:

    Unable to find python module. 
    Modules: 
    C:\Users\rchiodo\source\repos\debugpy\.tox\py311\Scripts\python.EXE
    C:\WINDOWS\SYSTEM32\ntdll.dll
    C:\WINDOWS\System32\KERNEL32.DLL
    C:\WINDOWS\System32\KERNELBASE.dll
    C:\WINDOWS\SYSTEM32\VERSION.dll
    C:\WINDOWS\System32\msvcrt.dll
    C:\WINDOWS\System32\sechost.dll
    C:\WINDOWS\System32\bcrypt.dll
    C:\WINDOWS\SYSTEM32\apisethost.appexecutionalias.dll
    C:\WINDOWS\System32\ucrtbase.dll
    C:\WINDOWS\System32\combase.dll
    C:\WINDOWS\System32\RPCRT4.dll
    C:\WINDOWS\System32\msvcp_win.dll
    C:\WINDOWS\SYSTEM32\profapi.dll
    C:\WINDOWS\System32\bcryptPrimitives.dll
    C:\WINDOWS\SYSTEM32\kernel.appcore.dll
    C:\WINDOWS\SYSTEM32\daxexec.dll
    C:\WINDOWS\System32\OLEAUT32.dll
    C:\WINDOWS\SYSTEM32\container.dll
    C:\WINDOWS\SYSTEM32\USERENV.dll
    C:\WINDOWS\System32\clbcatq.dll
    C:\WINDOWS\SYSTEM32\RpcRtRemote.dll
    C:\Windows\System32\Windows.StateRepositoryPS.dll
    C:\WINDOWS\SYSTEM32\AppXAllUserStore.dll
    C:\WINDOWS\SYSTEM32\windows.staterepositoryclient.dll
    C:\WINDOWS\SYSTEM32\windows.staterepositorycore.dll
    C:\WINDOWS\SYSTEM32\capauthz.dll
    C:\WINDOWS\System32\advapi32.dll
    C:\WINDOWS\SYSTEM32\ntmarta.dll
    C:\Users\rchiodo\source\repos\debugpy\src\debugpy\_vendored\pydevd\pydevd_attach_to_process\attach_amd64.dll
    C:\WINDOWS\SYSTEM32\MSVCP140.dll
    C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll
    C:\WINDOWS\SYSTEM32\VCRUNTIME140_1.dll
    C:\Users\rchiodo\source\repos\debugpy\src\debugpy\_vendored\pydevd\pydevd_attach_to_process\run_code_on_dllmain_amd64.dll
    

    And then looking at that Python.exe, it doesn't have a dependency on the python311.dll.

  4. rchiodo commented on Jul 26, 2024

    @rchiodo
    Contributor

    On linux this is flakey for me too. When it fails it seems to be gdb not being able to inject.

  5. int19h commented on Jul 27, 2024

    @int19h
    ContributorAuthor

    On Windows, when you have a virtual environment, python.exe (and also all the tools in Scripts) are small shims that spawn the actual Python binary from the base environment, because symlinks cannot be assumed to be safe to use for non-admin users, unlike on Unix. Hence why in those cases attach doesn't work - it can only see a child Python process if it is debugging the parent Python process that spawns it, but those shims aren't Python processes.

    However it is unclear to me why this isn't (or at least wasn't) a consistent repro, if that is indeed the problem. Perhaps it might be using symlinks instead of shims depending on how the machine is configured?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    test issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions