<br><br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The kind of errors I mentioned ("permission denied" errors that<br>seem to occur without an obvious reason) have cost me at least
<br>two weeks of debugging the hard way (with ProcessExplorer etc)<br>and caused my manager to loose his trust in Python at all...<br>I think it is well worth the effort to keep this trouble away from<br>the Python programmers if possible.
<br><br>And throughout the standard library modules, "open" is used,<br>causing these problems as soon as sub-processes come into play.<br><br>Apart from shutil.copyfile, other examples of using open that can cause
<br>trouble are in socket.py (tell me any good reason why socket handles<br>should be inherited to child processes) and even in logging.py.<br><br>For example, I used RotatingFileHandler for logging my daemon<br>program activity. Sometimes, the logging itself caused errors,
<br>when a still-running child process had inherited the log file handle<br>and log rotation occured.</blockquote><div><br>I just wanted to express to the group at large that these experiences aren't just Henning's; we spent a *tremendous* amount of time and effort debugging serious problems that arose from file handles getting shared to subprocesses where it wasn't really expected. Specifically, the RotatingFileHandler example above. It blatantly just breaks when subprocesses are used and its an extremely obtuse process to discover why.
<br><br>It was very costly to the company because it came up at a bad time and was *so* obtuse of an error. At first it looked like some sort of thread-safety problem, so a lot of prying went into that before we got stumped... after all, we *knew* no other process touched that file, and the logging module (and RotatingFileHandler) claimed and looked thread-safe, so.. how could it be having a Permission Denied error when it very clearly is closing the file before rotating it? Eventually the culprit was found, but it was very painful.
<br><br>A couple similar issues have arisen since, and they're only slightly easier to debug once you are expecting it. But the fact that the simple and obvious features provided in the stdlib break as a result of you launching a subprocess at some point sorta sucks :)
<span style="font-weight: bold;"></span> <br></div><br>So, yeah. Anything even remotely or vaguely approaching Henning's patch would be really, really appreciated.<br><br>--SH<br></div>