beeware / bugjar

A interactive graphical debugger for Python code.
BSD 3-Clause "New" or "Revised" License
249 stars 31 forks source link

Bugjar crashes on swagger client instantiation #15

Closed damienstanton closed 5 years ago

damienstanton commented 9 years ago

I am using the ARI-Py and Swagger-Py libraries to interface with the Asterisk open-source phone system. When debugging one of my modules, Bugjar crashes with the following traceback:

Traceback (most recent call last):
  File "C:\Python27\Scripts\bugjar-net-script.py", line 9, in <module>
    load_entry_point('bugjar==0.1.0', 'console_scripts', 'bugjar-net')()
  File "c:\python27\lib\site-packages\bugjar\main.py", line 153, in net
    net_run(options.hostname, options.port, filename, *options.args)
  File "c:\python27\lib\site-packages\bugjar\net.py", line 601, in run
    debugger.interaction(None, t)
  File "c:\python27\lib\site-packages\bugjar\net.py", line 226, in interaction
    self.output_stack()
  File "c:\python27\lib\site-packages\bugjar\net.py", line 161, in output_stack
    for frame, line_no in self.stack[str_index:]
  File "c:\python27\lib\site-packages\bugjar\net.py", line 150, in <genexpr>
    'locals': dict((k, repr(v)) for k, v in frame.f_locals.items()),
  File "build\bdist.win-amd64\egg\swaggerpy\client.py", line 189, in __repr__
  File "build\bdist.win-amd64\egg\swaggerpy\client.py", line 197, in __getattr__

... it then bounces between those last couple of lines several hundred times.

File "build\bdist.win-amd64\egg\swaggerpy\client.py", line 214, in get_resource
  File "build\bdist.win-amd64\egg\swaggerpy\client.py", line 197, in __getattr__

RuntimeError: maximum recursion depth exceeded while calling a Python object

I know about the lack of tail recursion in the language, but everything works perfectly fine outside the debugger.

freakboy3742 commented 9 years ago

Thanks for the report. It looks like the bugjar process inspector is getting tied in a knot trying to build a representation that it can use to describe a stack frame. It's trying to call repr to describe an object, but that's calling getattr, which is calling repr, and so on.

Are you able to reduce this to a minimal test case (so I don't need to get a full asterisk setup running just to reproduce the bug)? Is there anything interesting in the repr implementation on the object you're inspecting?

damienstanton commented 9 years ago

Nothing fancy should be going on; I'll see if I can reproduce it in a minimal case and let you know.

damienstanton commented 5 years ago

Never did reproduce this.