Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE should restart instead of hanging when subprocess exits #82876

Open
terryjreedy opened this issue Nov 5, 2019 · 3 comments
Open

IDLE should restart instead of hanging when subprocess exits #82876

terryjreedy opened this issue Nov 5, 2019 · 3 comments
Assignees
Labels
topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 38695
Nosy @terryjreedy
PRs
  • bpo-38689: avoid IDLE hanging when calltip fails getting a signature #17152
  • 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 = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2019-11-05.07:39:37.434>
    labels = ['expert-IDLE', 'type-bug']
    title = 'IDLE should restart instead of hanging when subprocess exits'
    updated_at = <Date 2019-11-14.10:52:49.556>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-11-14.10:52:49.556>
    actor = 'taleinat'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2019-11-05.07:39:37.434>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38695
    keywords = ['patch']
    message_count = 1.0
    messages = ['356009']
    nosy_count = 1.0
    nosy_names = ['terry.reedy']
    pr_nums = ['17152']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38695'
    versions = []

    @terryjreedy
    Copy link
    Member Author

    This is a spinoff from bpo-38689, about 'strange_callable(' in Shell hanging, because there is an uncaught exception is the run process. (See issue for 'strange_callable'.) Running IDLE from Windows Command Prompt, Windows eventually shows the circle cursor. Clicking on the window turns it gray and trying to close it by clicking 'X' brings up 'Python is not responding' with options to Wait, Close, or Try to Restore. I have seen this before with other code.

    Restore results in the GUI process RESTARTing a run process and the following in the console.

    Exception in Tkinter callback
    Traceback (most recent call last):
      File "f:\dev\3x\lib\idlelib\rpc.py", line 359, in pollpacket
        s = self.sock.recv(BUFSIZE)
    ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "f:\dev\3x\lib\idlelib\rpc.py", line 432, in pollresponse
        message = self.pollmessage(wait)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 384, in pollmessage
        packet = self.pollpacket(wait)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 361, in pollpacket
        raise EOFError
    EOFError
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "f:\dev\3x\lib\tkinter\__init__.py", line 1885, in __call__
        return self.func(*args)
      File "f:\dev\3x\lib\idlelib\multicall.py", line 176, in handler
        r = l[i](event)
      File "f:\dev\3x\lib\idlelib\calltip.py", line 51, in try_open_calltip_event
        self.open_calltip(False)
      File "f:\dev\3x\lib\idlelib\calltip.py", line 70, in open_calltip
        argspec = self.fetch_tip(expression)
      File "f:\dev\3x\lib\idlelib\calltip.py", line 95, in fetch_tip
        return rpcclt.remotecall("exec", "get_the_calltip",
      File "f:\dev\3x\lib\idlelib\rpc.py", line 219, in remotecall
        return self.asyncreturn(seq)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 248, in asyncreturn
        response = self.getresponse(seq, wait=0.05)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 291, in getresponse
        response = self._getresponse(myseq, wait)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 311, in _getresponse
        response = self.pollresponse(myseq, wait)
      File "f:\dev\3x\lib\idlelib\rpc.py", line 436, in pollresponse
        self.handle_EOF()
      File "f:\dev\3x\lib\idlelib\pyshell.py", line 389, in handle_EOF
        raise EOFError
    EOFError

    (Close, after confirmation, results in nothing except the Windows > prompt.)

    This suggests to me that the remote process running idlelib.run should have an outer try-except that catches everything and sends "I am stopping" before exiting. The GUI process would then RESTART a new subprocess. There are conditions under which this already happens, so it seems that the current trigger just needs to be broadened.

    @terryjreedy terryjreedy self-assigned this Nov 5, 2019
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Nov 5, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @furkanonder
    Copy link
    Sponsor Contributor

    @terryjreedy The issue seems to have been resolved. I think we can close the issue.

    @terryjreedy
    Copy link
    Member Author

    Not quite. This issue is about not hanging for any other cause.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    Status: In Progress
    Development

    No branches or pull requests

    2 participants