Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Attach to pid fails to attach in 3.7 #846

Closed
karthiknadig opened this issue Sep 26, 2018 · 6 comments
Closed

Attach to pid fails to attach in 3.7 #846

karthiknadig opened this issue Sep 26, 2018 · 6 comments

Comments

@karthiknadig
Copy link
Member

Environment data

  • PTVSD version: master
  • OS and version: windows
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7
  • Using VS Code or Visual Studio: VSC

Actual behavior

Follow error message is shown:

Connecting to 64 bits target
Injecting dll
Dll injected
Allocating code in target process
Writing code in target process
Allocating return value memory in target process
Injecting code to target process
Waiting for code to complete
Error when injecting code in target process. Error code: 3 (on windows)

Expected behavior

Should attach.

Steps to reproduce:

  1. Use this test code, test.py:
import time
for x in range(10000):
    time.sleep(1)
    print(x)
  1. Open command prompt and run test code: C:\Python37\python.exe test.py
  2. Open another command prompt and run ptvsd:
    C:\Python37\python.exe -m ptvsd --host localhost --port 5678 --pid <pid_of _test>
@fabioz
Copy link
Contributor

fabioz commented Sep 26, 2018

Attach to process needs support for Python 3.7 (please assign to me to add it).

@karthiknadig karthiknadig changed the title Attach to pid fails to attach often Attach to pid fails to attach in 3.7 Sep 26, 2018
@andyneff
Copy link

andyneff commented Oct 1, 2018

This also does not work in linux.

The attachee crashes with

Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pydevd_tracing'

If the attachee is run with PYTHONPATH=/usr/local/lib/python3.7/site-packages/ptvsd/_vendored/pydevd python test.py or similar, then

warning: Debugger speedups using cython not found. Run '"/usr/local/bin/python" "/usr/local/lib/python3.7/site-packages/ptvsd/_vendored/pydevd/setup_cython.py" build_ext --inplace' to build.

And the a attacher (python -m ptvsd --port 5678 --pid 32) says

from ptvsd._remote import attach
attach((hostname, 5678))
", 0)' --command='/usr/local/lib/python3.7/site-packages/ptvsd/_vendored/pydevd/pydevd_attach_to_process/linux/gdb_threads_settrace.py'
Running gdb in target process.
stdout: b'[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".\n0x00007f7e962443a3 in select () from /lib/x86_64-linux-gnu/libc.so.6\nThe target architecture is assumed to be i386:x86-64\n$1 = 444824848\n$2 = 13\n'
stderr: b'Newline characters may not appear in string constants.\n'

@andyneff
Copy link

andyneff commented Oct 1, 2018

This also fails the exact same way in python 3.6.6. Is this a separate issue?

@fabioz
Copy link
Contributor

fabioz commented Oct 2, 2018

This one is only to track the issue with python 3.7 on Windows.

The issue with python 3.6 on Linux seems to be something different (so, please create a separate report).

@fabioz
Copy link
Contributor

fabioz commented Jun 13, 2019

@karthiknadig I'm updating the native code here... right now, in the pydevd repo I compile the resulting dlls (for x86 and x64) on my machine and commit those to the repo to ease on deployment, so, my question is: should I provide those compiled dlls in a pull request (as happens in pydevd) or just the source code?

-- as a note, in the current master, the committed version on ptvsd and pydevd are equal (binary-wise), so, it seems that it's using the same binary I compiled/committed in pydevd.

@karthiknadig
Copy link
Member Author

Committing the binary is fine. We will also need the symbols for the dlls in windows.

fabioz added a commit to fabioz/ptvsd that referenced this issue Jun 14, 2019
@fabioz fabioz closed this as completed in 1fce9be Jun 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants