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

Fix multithreading stepping in 3.12 and later #1798

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

rchiodo
Copy link
Contributor

@rchiodo rchiodo commented Jan 7, 2025

Fix for #1765

After adding a bunch of logging I found that one thread would send a breakpoint event, 'return' events were still being fired for other threads. When the 'breakpoint' thread suspended itself and all other threads, it sets the 'step' mode for all other threads to step into, so when those return events came in, we were getting other threads in step mode. This makes the debugger jump all over the place when stepping (as all threads look like they're stepping).

The fix here was to just ignore any events after a thread is suspended. Other threads shouldn't be sending a separate stopped event after they've been suspended.

Added a test to pydevd to verify this works.

@rchiodo rchiodo requested a review from a team as a code owner January 7, 2025 01:09
@@ -0,0 +1,7 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file supposed to be in source control? It might be, I just wasn't sure since it was in the .vscode directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be. It's common settings. It makes debugpy tests runnable from the test runner in VS code.

@rchiodo rchiodo merged commit 02723de into microsoft:main Jan 7, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants