Patches item #1529142, was opened at 2006-07-26 20:45 Message generated for change (Comment added) made by taleinat You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1529142&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: IDLE Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Tal Einat (taleinat) Assigned to: Kurt B. Kaiser (kbk) Summary: Allowing multiple instances of IDLE with sub-processes Initial Comment: (See patch 1201569 "allow running multiple instances of IDLE" for previous discussion on this topic) To summarize discussion up to this point: There is a problem doing this on Windows since more than one listening socket can be openned on a single port. I suggest we "dodge" the Windows problem for now by having IDLE try a random port every time (like in the IDLEfork patch 661363) - thus collisions will be kept to a minimum. If we choose among over 10,000 ports, most users will never encounter a port collision. And even when a collision does happen, it will probably be detected and properly dealt with - collision non-detection errors are, as Kurt mentioned, erratic. This patch chooses a port from range(49152, 65536), which are the 'dynamic' ports as described by the DCCP (see http://www.iana.org/assignments/port-numbers), and avoids known 'dangerous' ports (used by trojans, worms, etc.) which I gathered by Googling for half an hour. I replaced socket.timeout with select(), since I find its timeout mechanism is more reliable. (Currently, Python's socket's timeout mechanism raises unexpected, unexplained errors on Windows.) I also changed the flow a bit, so if a timeout occurs after a sub-process is spawned, the subprocess is killed. IMO This requires thorough testing. I tested it for half an hour on my WinXP Python2.4.3, and after fixing typos and such, everything seems to work. ---------------------------------------------------------------------- >Comment By: Tal Einat (taleinat) Date: 2007-02-07 09:49 Message: Logged In: YES user_id=1330769 Originator: YES After removing the SO_REUSEADDR flag, this has been working without any pauses, delays or hitches on my WinXP Python2.5 install. I sometimes have as many as 8 separate instances of IDLE running in parallel, with no side effects. About the SO_REUSEADDR flag, I'm wondering if this is still required on Posix systems now that we're choosing random ports. If so, we should choose whether to use this flag based on the OS. Is there any good reason -not- to choose a random port? I can't think of any. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1529142&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches