This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Aneesh, Peter.Caven, brian.curtin, eli.bendersky, georg.brandl, kbk, loewis, ned.deily, sunqiang, terry.reedy, tim.golden, vstinner
Date 2011-07-23.19:43:17
SpamBayes Score 2.220446e-16
Marked as misclassified No
Message-id <1311450198.44.0.838925088212.issue12540@psf.upfronthosting.co.za>
In-reply-to
Content
Eli, nice detective work. What I understand is that there was a latent platform-dependent buglet that presumably got exposed by a recent change in process handling, as Ned suggested.

idlelib/PyShell.py, class ModifiedInterpreter(InteractiveInterpreter) has
    def spawn_subprocess(self):
        if self.subprocess_arglist is None:
            self.subprocess_arglist = self.build_subprocess_arglist()
        args = self.subprocess_arglist
        self.rpcpid = os.spawnv(os.P_NOWAIT, sys.executable, args)

so IDLE expects the return to always be a pid which it is not.

Spawn_subprocess is called in both start_subprocess and restart_subprocess. Both now leave zombies on exit. I presume idlelib.run.main listens on the passed in port (in args) to make the connection. It appears to me that restart reuses the socket wrapped in self.rpcclt (rpc client).

Using subprocess.Popen seems like an good idea. The subprocess module is explicitly intended to replace low-level, fragile, difficult to get right, usage of os.spawn* and similar. If it does not work for this problem, *it* should be fixed.

On the other hand, IDLE uses sockets rather than pipes to communicate with subproccesses, perhaps because Windows pipes either are or were not as usable as unix pipes. Also, named or reusable pipes may not be usiversally available, so wrapping a pipe instead of a socket would, it seems to me, take more than simple replacement of spawnv by Popen.

Kurt, what do you think about possible fixes to this bug (critical for using IDLE on Windows)?
History
Date User Action Args
2011-07-23 19:43:18terry.reedysetrecipients: + terry.reedy, loewis, georg.brandl, kbk, vstinner, tim.golden, ned.deily, eli.bendersky, brian.curtin, sunqiang, Peter.Caven, Aneesh
2011-07-23 19:43:18terry.reedysetmessageid: <1311450198.44.0.838925088212.issue12540@psf.upfronthosting.co.za>
2011-07-23 19:43:17terry.reedylinkissue12540 messages
2011-07-23 19:43:17terry.reedycreate