pudb icon indicating copy to clipboard operation
pudb copied to clipboard

Traceback while navigating through debugger UI

Open mvanderkamp opened this issue 5 years ago • 9 comments

I was using the arrow keys to navigate around the UI and suddenly the debugger crashed, the program I was debugging along with it, and this traceback showed up.

I've scrubbed the traceback a bit so it only shows relevant information:

Traceback (most recent call last):
  File "..../python2.7/bdb.py", line 49, in trace_dispatch
    return self.dispatch_line(frame)
  File "..../pudb/debugger.py", line 210, in dispatch_line
    self.user_line(frame)
  File "..../pudb/debugger.py", line 431, in user_line
    self.interaction(frame)
  File "..../pudb/debugger.py", line 399, in interaction
    show_exc_dialog=show_exc_dialog)
  File "..../pudb/debugger.py", line 2236, in call_with_ui
    return f(*args, **kwargs)
  File "..../pudb/debugger.py", line 2497, in interaction
    self.event_loop()
  File "..../pudb/debugger.py", line 2463, in event_loop
    toplevel.keypress(self.size, k)
  File "..../pudb/ui_tools.py", line 120, in keypress
    result = self._w.keypress(size, key)
  File "..../python2.7/site-packages/urwid/container.py", line 1131, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "..../python2.7/site-packages/urwid/container.py", line 2310, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "..../python2.7/site-packages/urwid/container.py", line 1621, in keypress
    key = self.focus.keypress(tsize, key)
  File "..../pudb/ui_tools.py", line 120, in keypress
    result = self._w.keypress(size, key)
  File "..../python2.7/site-packages/urwid/container.py", line 1621, in keypress
    key = self.focus.keypress(tsize, key)
  File "..../python2.7/site-packages/urwid/listbox.py", line 966, in keypress
    return actual_key(self._keypress_up((maxcol, maxrow)))
  File "..../python2.7/site-packages/urwid/listbox.py", line 1033, in _keypress_up
    row_offset, 'below')
  File "..../python2.7/site-packages/urwid/listbox.py", line 849, in change_focus
    raise ListBoxError("Invalid offset_inset: %s, only %s rows in target!" %(offset_inset, tgt_rows))
ListBoxError: Invalid offset_inset: -4, only 4 rows in target!

Possibly relevant: I had the setting enabled where the terminal is hidden when not in use.

mvanderkamp avatar Oct 30 '20 19:10 mvanderkamp

Thanks for the report!

  • What's the urwid version?
  • I've not encountered any such crash, and I can't reproduce it. Do you have an at least half-way reliable recipe that leads to this?

inducer avatar Oct 30 '20 19:10 inducer

looks like urwid is 2.1.0

I'll also call attention to the "python 2.7" aspect of the tracebacks. I'm unfortunately stuck in an environment where I'm required to use python 2. This failure may be related to that as well.

I'll see if I can figure out reproduction steps...

mvanderkamp avatar Oct 30 '20 20:10 mvanderkamp

I haven't been able to figure out reproduction steps, but I have managed to hit other tracebacks in various places that crash the debugger.

Given that we have a mechanism for neatly logging errors, would it make sense to catch and log exceptions from the debugger generally at the event loop level?

mvanderkamp avatar Dec 17 '20 22:12 mvanderkamp

Yeah, I wouldn't be opposed.

inducer avatar Dec 17 '20 23:12 inducer

Happens too often for me, on python 2, and now on python 3, but not found how to reproduce it yet.

ubuntu docker (Ubuntu 22.04.1 LTS) + uwsgi pudb 2022.1.2 python 3.10.4 urwid 2.1.2 urwid-readline 0.13

python version: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
pudb version: 2022.1.2
urwid version: 2.1.2
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pudb/debugger.py", line 2690, in event_loop
    toplevel.keypress(self.size, k)
  File "/usr/local/lib/python3.10/dist-packages/pudb/ui_tools.py", line 119, in keypress
    result = self._w.keypress(size, key)
  File "/usr/local/lib/python3.10/dist-packages/urwid/container.py", line 1135, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/usr/local/lib/python3.10/dist-packages/urwid/container.py", line 2316, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/usr/local/lib/python3.10/dist-packages/urwid/container.py", line 1626, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/local/lib/python3.10/dist-packages/pudb/ui_tools.py", line 119, in keypress
    result = self._w.keypress(size, key)
  File "/usr/local/lib/python3.10/dist-packages/urwid/container.py", line 1626, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/local/lib/python3.10/dist-packages/urwid/listbox.py", line 979, in keypress
    return actual_key(self._keypress_up((maxcol, maxrow)))
  File "/usr/local/lib/python3.10/dist-packages/urwid/listbox.py", line 1045, in _keypress_up
    self.change_focus((maxcol,maxrow), pos,
  File "/usr/local/lib/python3.10/dist-packages/urwid/listbox.py", line 862, in change_focus
    raise ListBoxError("Invalid offset_inset: %s, only %s rows in target!" %(offset_inset, tgt_rows))
urwid.listbox.ListBoxError: Invalid offset_inset: -3, only 3 rows in target!

lega911 avatar Aug 23 '22 08:08 lega911

Do you at least know what key you pressed and where the cursor was when you pressed it? That information isn't really present in the traceback.

asmeurer avatar Aug 23 '22 23:08 asmeurer

I think we can infer from this that it was the up arrow:

 File "/usr/local/lib/python3.10/dist-packages/urwid/listbox.py", line 979, in keypress
    return actual_key(self._keypress_up((maxcol, maxrow)))
 File "/usr/local/lib/python3.10/dist-packages/urwid/listbox.py", line 1045, in _keypress_up
    self.change_focus((maxcol,maxrow), pos,

mvanderkamp avatar Aug 23 '22 23:08 mvanderkamp

@asmeurer yes, but trying to replay the same flow nothing happens, it happens randomly. maybe I catch how to reproduce it one day :)

@mvanderkamp yes, usually it happens when I move cursor down ("under the screen"/after last rows of a file) and try to go back to up "keypress_up" (the same by scrolling mouse)

lega911 avatar Aug 24 '22 06:08 lega911

Maybe you somehow edited the file while pudb was running and it caches the incorrect number of lines, leading to the out of bounds error.

asmeurer avatar Aug 24 '22 08:08 asmeurer