Search code examples
pythonvisual-studio-codeodoovscode-debugger

Visual Studio Code Python Debugger Missing Other Threads in Call Stacks


Basic Info

  • Environment: Windows 11
  • Python Version: 3.8.10
  • Use virtual env: Yes
  • VSCode Python extension version: v2022.20.2

Problem

I tried running an Odoo 15 (multi-threaded) application and previously I was able to see that VSCode properly tracked all spawned thread.

However yesterday when I tried to debug my application, I noticed that my breakpoints on code that was supposed to be run on spawned threads weren't hitting (main thread is fine).

After looking at the call stack window, I noticed that what used to be a list of threads are now showing nothing as if there's only 1 thread running.

Call stack on my Odoo 15 program

Figure 1. Call stack on my Odoo program

So I'm wondering that it has something to do with my VSCode settings, but I'm drawing a blank on which. Interestingly, on my colleague's Linux machine, he can debug and see all the threads fine with VSCode

I've tried to do a clean uninstallation of VSCode and re-installed all extensions manually, but to no avail.

Interestingly, I tried writing a simple threaded program (with threading lib, same as Odoo's) and the call stack showed the multiple threads fine, so I'm lost as of why

Call stack on multi-threaded programs

Figure 2. Call stack on my simple threaded programs


Solution

  • Turns out I have an entry in my .env GEVENT_SUPPORT=True.

    Once I erased that flag, everything works normal