[New-bugs-announce] [issue38695] IDLE should restart instead of hanging when subprocess exits

Terry J. Reedy report at bugs.python.org
Tue Nov 5 02:39:37 EST 2019


New submission from Terry J. Reedy <tjreedy at udel.edu>:

This is a spinoff from #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.

----------
assignee: terry.reedy
components: IDLE
messages: 356009
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE should restart instead of hanging when subprocess exits
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38695>
_______________________________________


More information about the New-bugs-announce mailing list