Skip to content

IDLE hangs when selecting Stack View with debug active #67732

Closed

Description

@AndrewHarrington
BPO 23544
Nosy @terryjreedy, @taleinat, @ZackerySpytz, @miss-islington
PRs
  • bpo-23544: Disable IDLE Stack Viewer when running user code #17163
  • [3.9] bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163) #24365
  • [3.8] bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163) #24366
  • Files
  • goodScope.py: simple demo file from my tutorial
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-01-29.01:50:04.803>
    created_at = <Date 2015-02-27.21:25:35.769>
    labels = ['expert-IDLE', '3.9', 'type-crash']
    title = 'IDLE hangs when selecting Stack View with debug active'
    updated_at = <Date 2021-01-29.01:50:04.802>
    user = 'https://bugs.python.org/AndrewHarrington'

    bugs.python.org fields:

    activity = <Date 2021-01-29.01:50:04.802>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-29.01:50:04.803>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2015-02-27.21:25:35.769>
    creator = 'Andrew.Harrington'
    dependencies = []
    files = ['38269']
    hgrepos = []
    issue_num = 23544
    keywords = ['patch']
    message_count = 12.0
    messages = ['236842', '236848', '236853', '236864', '236905', '320686', '356652', '356653', '385889', '385890', '385892', '385893']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'taleinat', 'Andrew.Harrington', 'ZackerySpytz', 'miss-islington']
    pr_nums = ['17163', '24365', '24366']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue23544'
    versions = ['Python 3.9']

    Activity

    1. AndrewHarrington commented on Feb 27, 2015

      AndrewHarringtonmannequin
      MannequinAuthor
      1. In idle 3.4.3, OSX 10.10, active state Tk 8.5.17, starting data:

      Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
      [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

      1. start debugger, open very simple demo file, attached:

      2. run, so debugger starts, step into main()

      3. In debug menu, select Stack Viewer

      4. hangs (apple swirling color wheel forever). Same error is repeatable.

    2. ned-deily commented on Feb 27, 2015

      @ned-deily
      Member

      Thanks for the detailed report. The problem is more general as it is reproducible on Linux X11-based IDLEs as well.

    3. changed the title [-]Idle stacker viewer crash OSX[/-] [+]IDLE hangs with debug on and stack viewer[/+] on Feb 27, 2015
    4. terryjreedy commented on Feb 27, 2015

      @terryjreedy
      Member

      Verified on Windows whenever the debugger is active, meaning that a program is running. (Debug On just means that it will become active when code is run.) No stepping is needed; debugger can be pointing to the inital docstring line. For me also, Idle stops and has to be externally closed, as opposed to totally disappearing by itself.

      The doc for Stack Viewer says "Show the stack traceback of the last exception". Example:

      >>> 1/0
      Traceback (most recent call last):
        File "<pyshell#0>", line 1, in <module>
          1/0
      ZeroDivisionError: division by zero
      >>> 

      Selecting Stack Viewer pops up a viewer box. This still works after
      [DEBUG ON]

      >>
      turns the debugger on but inactive. Entering anything at the prompt disables viewing the 'last' exception, contrary to my understanding of the short doc. So I might add '(if no other code has been run)' to the doc.

      Selecting Stack Viewer while a program is running (sleeping in this next example)

      >> import time; time.sleep(10); 1/0

      brings up a box after the exception is printed.  So 'last exception' can actually be 'next exception'.  But in this case, the user process is left 'running' and no '>>> ' prompt appears, and one must Shell -> Restart to do anything further.  This is not good behavior.

      When one selects Debug -> Debugger while user code is running, Idle brings up a message box "Don't debug now: You can only toggle the debugger when idle". I think Debug -> Stack Viewer should be similarly disabled, though perhaps graying out the menu entry might be better. It could also be grayed out when there the 'last exception' cannot be viewed because other code has been run. Stack Viewer should definitely be ignored when the debugger is active, and I see no need to let people select it *before* an exception occurs and the prompt is displayed. The next menu entry, Auto-open Stack Viewer, takes care of opening upon future exceptions.

    5. changed the title [-]IDLE hangs with debug on and stack viewer[/-] [+]IDLE hangs when selecting Stack View with debug active[/+] on Feb 27, 2015
    6. AndrewHarrington commented on Feb 28, 2015

      AndrewHarringtonmannequin
      MannequinAuthor

      I was using this without looking at documentation, as a newbies would.
      Graying and disabling until after an exception makes sense, but even the
      menu item name is misleading: any time the program is running there is a
      stack that you might want to view. Better labels in the menu than "Stack
      Viewer" would be "stack trace" or "stack after exception" (maybe too long)
      or "stack after crash".

      On Fri, Feb 27, 2015 at 4:49 PM, Terry J. Reedy <report@bugs.python.org>
      wrote:

      >
      > Terry J. Reedy added the comment:
      >
      > Verified on Windows whenever the debugger is active, meaning that a
      > program is running.  (Debug On just means that it will become active when
      > code is run.) No stepping is needed; debugger can be pointing to the inital
      > docstring line.  For me also, Idle stops and has to be externally closed,
      > as opposed to totally disappearing by itself.
      >
      > The doc for Stack Viewer says "Show the stack traceback of the last
      > exception".   Example:
      >
      > >>> 1/0
      > Traceback (most recent call last):
      >   File "<pyshell#0>", line 1, in <module>
      >     1/0
      > ZeroDivisionError: division by zero
      > >>>
      >
      > Selecting Stack Viewer pops up a viewer box.  This still works after
      > [DEBUG ON]
      > >>>
      > turns the debugger on but inactive.  Entering anything at the prompt
      > disables viewing the 'last' exception, contrary to my understanding of the
      > short doc.  So I might add '(if no other code has been run)' to the doc.
      >
      > Selecting Stack Viewer while a program is running (sleeping in this next
      > example)
      >
      > >>> import time; time.sleep(10); 1/0
      >
      > brings up a box after the exception is printed.  So 'last exception' can
      > actually be 'next exception'.  But in this case, the user process is left
      > 'running' and no '>>> ' prompt appears, and one must Shell -> Restart to do
      > anything further.  This is not good behavior.
      >
      > When one selects Debug -> Debugger while user code is running, Idle brings
      > up a message box "Don't debug now: You can only toggle the debugger when
      > idle".  I think Debug -> Stack Viewer should be similarly disabled, though
      > perhaps graying out the menu entry might be better. It could also be grayed
      > out when there the 'last exception' cannot be viewed because other code has
      > been run.  Stack Viewer should definitely be ignored when the debugger is
      > active, and I see no need to let people select it *before* an exception
      > occurs and the prompt is displayed.  The next menu entry, Auto-open Stack
      > Viewer, takes care of opening upon future exceptions.
      >
      > 

      stage: -> needs patch
      title: IDLE hangs with debug on and stack viewer -> IDLE hangs when
      selecting Stack View with debug active


      Python tracker <report@bugs.python.org>
      <http://bugs.python.org/issue23544\>


      --
      Dr. Andrew N. Harrington
      Computer Science Department
      Graduate Program Director gpd@cs.luc.edu
      Loyola University Chicago
      529 Lewis Tower, 111 E. Pearson St. (Downtown)
      104 Loyola Hall, 1032 W. Sheridan Road (Rogers Park)
      http://www.cs.luc.edu/~anh
      Phone: 312-915-7982
      Fax: 312-915-7998
      aharrin@luc.edu (as professor, not gpd role)

    7. terryjreedy commented on Feb 28, 2015

      @terryjreedy
      Member

      I agree that 'Stack Viewer' does not explain what this does, which is to gives a more detail view of the stack and name bindings after an exception. The doc entry does not either. I will consider 'Stack Trace' or maybe 'Exception Review'. I think a popup message is needed too.

      PS. When replying to email, please snip the messages you are responding to (except possible for a line or two). That message sits above yours when viewed on the web page.

    8. terryjreedy commented on Jun 28, 2018

      @terryjreedy
      Member

      This crashes or hangs the user execution process, but not the IDLE process. So Shell => 'Restart Shell cntl-F6' still works.

    9. taleinat commented on Nov 15, 2019

      @taleinat
      Contributor

      Taking this in a different direction, perhaps we can make the stack viewer always work, regardless of whether it is immediately after an exception? Visually inspecting the stack can be useful not just for understanding error cases.

    10. taleinat commented on Nov 15, 2019

      @taleinat
      Contributor

      perhaps we can make the stack viewer always work

      Well, perhaps not "always", e.g. probably not while user code is running.

    11. terryjreedy commented on Jan 28, 2021

      @terryjreedy
      Member

      New changeset 23a567c by Zackery Spytz in branch 'master':
      bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163)
      23a567c

    12. miss-islington commented on Jan 28, 2021

      @miss-islington
      Contributor

      New changeset 6d87dec by Miss Islington (bot) in branch '3.9':
      bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163)
      6d87dec

    13. terryjreedy commented on Jan 29, 2021

      @terryjreedy
      Member

      New changeset 901a983 by Miss Islington (bot) in branch '3.8':
      bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163) (bpo-24366)
      901a983

    14. terryjreedy commented on Jan 29, 2021

      @terryjreedy
      Member

      Tal, I agree with you.

      The debugger is an execution controller with an optional current-frame viewer updated whenever execution is paused. It displays both name and value. I believe a current PR addresses the issue of value representations being indefinitely long and possibly overflowing the space allotted.

      The stack viewer can view any frame on the stack, but only after an exception. At least currently, on Windows, it omits value names. And there are other issues (bpo-24790). The debugger viewer and stack viewer should be combined with the best features of each (new issues).

      In the meanwhile, I finished PR and merged.

    15. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.9 (EOL)end of lifetopic-IDLEtype-crashA hard crash of the interpreter, possibly with a core dump

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions