Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach to process takes a long time #1044

Closed
yevgeni-zolotko opened this issue Sep 7, 2022 · 4 comments
Closed

Attach to process takes a long time #1044

yevgeni-zolotko opened this issue Sep 7, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@yevgeni-zolotko
Copy link

Environment data

  • debugpy version: 1.6.2
  • OS and version: Microsoft Windows [Version 10.0.22000.856]
  • Python version: Python 3.8.10
  • Using VS Code or Visual Studio: VS Code 1.71.0

Actual behavior

Attaching the debugger to a python process running simple script takes a long time (around 6 seconds on my machine). This is reproducible on several other Windows machines.

Expected behavior

Attaching to a python process is faster (ideally less than 1 second).

Steps to reproduce:

  1. Create the following script and save it to file called script.py:
input("Press Enter...")
print("Finished")
  1. Run the command: python script.py
  2. In VS Code with the Python extension installed, start debugging by selecting Attach Using Process ID and choosing the python process started in the previous step.
  3. In VS Code, notice the progress indicator being displayed for a long time (about 6 seconds on my machine) before the debugger is attached to the process and its features like breakpoints work
@fabioz
Copy link
Collaborator

fabioz commented Sep 7, 2022

Closing (duplicate of #1003).

Please see if #1003 (comment) fixes it for you (note: you need to set that environment variable in your system or in the shell that spawns VSCode).

@fabioz
Copy link
Collaborator

fabioz commented Sep 7, 2022

Reopening (I missed that it was in a different OS).

@fabioz
Copy link
Collaborator

fabioz commented Sep 7, 2022

I'm not sure how much this is something we can fix (6 seconds isn't that much time and unfortunately just importing libraries on Python is pretty slow).

Historically we had to pre-load everything due to Python 2.7 deadlocking in lazy imports in the debugger due to its lock around imports... maybe we could revisit this now that Python 2 support is dropped to import less things at startup.

@int19h int19h added the enhancement New feature or request label Sep 12, 2022
@int19h
Copy link
Contributor

int19h commented Feb 1, 2023

It looks like we can't do much about this, unfortunately.

@int19h int19h closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants