inducer / inducer/pudb

pudb takes a long time to display GUI, taking 100% CPU

Open
#38 3 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
3.2k
Forks
245
Avg merge
13m
Merged PRs (30d)
5

Description

I am working with a pretty big code base and when hitting a pudb.set_trace() the thread goes to 100% CPU and stays there for almost one and a half minute before the pudb GUI shows up. Once when I interrupted it because I was tired of waiting I got this traceback:

```
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/__main__.py", line 3, in
main()
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/run.py", line 30, in main
steal_output=options.steal_output)
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/__init__.py", line 48, in runscript
for bpoint_descr in load_breakpoints(dbg):
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/settings.py", line 389, in load_breakpoints
return parse_breakpoints(lines)
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/settings.py", line 362, in parse_breakpoints
if get_breakpoint_invalid_reason(filename, lineno) is None:
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/lowlevel.py", line 41, in get_breakpoint_invalid_reason
if lineno not in get_executable_lines_for_file(filename):
File "/home/andersh/env_resolve/lib/python2.7/site-packages/pudb-2012.2-py2.7.egg/pudb/lowlevel.py", line 16, in get_executable_lines_for_file
codes = [compile("".join(getlines(filename)), filename, "exec")]
KeyboardInterrupt
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pudb/settings.py at load_breakpoints and parse_breakpoints, then follow the call into pudb/lowlevel.py's get_executable_lines_for_file shown in the traceback. Reproduce the delay with a large Python codebase and inspect the breakpoint-loading path. Done means pudb's GUI opens without the prolonged 100% CPU wait, with coverage for the reported case if the repository's tests support it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.