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

Debugger fails to stop at breakpoint (in multi-threaded code) #282

@DonJayamanne

Description

@DonJayamanne

I've got a couple of unit tests in VSC Python extension, one of the tests fail almost -25%-50% of the time when using the new PTVSD debugger. What's interesting is the same tests pass 100% of the time when using the old PTVSD debugger.

Here's the python code

print("step1")
import sys
import threading
import time
print("step2")

def bar():
    time.sleep(2)
    print("print")

def foo(x):
    while True:
        bar()   # add breakpoint here <-

threading.Thread(target=lambda: foo(2), name="foo").start()
foo(1)

In the unit test I add a breakpoint to the line bar() inside the loop.
I can see (after placing print statements) that two threads are running the while loop.
However, the tests fail as the debugger fails to break at the break point.

@karthiknadig cc.
I know you have experienced a few issues with multi-threaded debugging.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions