Issue 7151: regrtest -j sometimes fails if output gets written to stderr by a test (original) (raw)

In certain circumstances output written to stderr during a test comes after the json result string the -j code is expecting to see at the end of the returned subprocess output. This causes that regrtest worker thread to fail. This problem is more acute on py3k; perhaps the new io library is more likely to delay output of stderr.

Attached is a patch that avoids the problem by capturing stderr separately. This means that all stderr output will be after all regular output, which changes the output of the test suite slightly (eg: in a debug build all the refcount messages come after the output from test_subprocess). This seems like a small enough issue that it isn't worth the code complexity required to code around it, especially since the ordering of the interleaving of the two streams isn't guaranteed even without -j.