Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugger times out at "Collecting data..."

I am debugging a Python (3.5) program with PyCharm (PyCharm Community Edition 2016.2.2 ; Build #PC-162.1812.1, built on August 16, 2016 ; JRE: 1.8.0_76-release-b216 x86 ; JVM: OpenJDK Server VM by JetBrains s.r.o) on Windows 10.

The problem: when stopped at some breakpoints, the Debugger window is stuck at "Collecting data", which eventually timeout. (with Unable to display frame variables)

The data to be displayed is neither special, nor particularly large. It is somehow available to PyCharm since a conditional break point on some values of the said data works fine (the program breaks) -- it looks like the process to gather it for display only (as opposed to operational purposes) fails.

When I step into a function around the place I have my breakpoint, its data is displayed correctly. When I go up the stack (to the calling function, the one I stepped down from and where I wanted initially to have the breakpoint) - I am stuck with the "Collecting data" timeout again.

There have been numerous issues raised with the same point since at least 2005. Some were fixed, some not. The fixes were usually updates to the latest version (which I have).

Is there a general direction I can go to in order to fix or work around this family of problems?


EDIT: a year later the problem is still there and there is still no reaction from the devs/support after the bug was raised.


EDIT April 2018: It looks like the problem is solved in the 2018.1 version, the following code which was hanging when setting a breakpoint on the print line now works (I can see the variables):

import threading  def worker():     a = 3     print('hello')  threading.Thread(target=worker).start() 
like image 441
WoJ Avatar asked Sep 07 '16 13:09

WoJ


People also ask

What is PDB debugging?

The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame.

How do I stop a debugging session?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

What is PDB Set_trace ()?

There are several ways to invoke a debugger. To start debugging within the program just insert import pdb, pdb. set_trace() commands. Run your script normally and execution will stop where we have introduced a breakpoint. So basically we are hard coding a breakpoint on a line below where we call set_trace().


1 Answers

I had the same question when i use pycharm2018.2 to debug my web application.

The project is a complex flask web server that combined with SocketIO.

When I made a debug breakpoint inside the code then pressed the debug button, it stopped at the breakpoint, but the variables didn't load. It just collected data data. I made some tweaks to the debugger settings in the end and this made it work. See the following image for the setting to change:

Image

like image 144
linkliu mayuyu Avatar answered Oct 09 '22 03:10

linkliu mayuyu