Open bdbaddog opened 6 years ago
Parallel build is essential, and it should come with as few con's as possible. Unreadable build logs can become an issue, and it's the topic here, as far as I see.
I'd like to point out that Make offers a couple options to deal with log readability, which SCons can use as an orientation: https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
Obviously, this topic has come up a number of times before. SCons doesn't normally capture any of the output from the external commands it passes off work to, but it does have the ability to do so in one very specific circumstance - when performing checks for a Configure context. Theoretically that could be expanded, but imagine there would be a fair bit of plumbing.
PR's welcome...
Any PR in this area would want to first ratchet forward the intended platform module refactor to use modern interfaces, and then build off that. subprocess.run
is a simple interface to run commands, and it uses Popen.communicate()
under the covers and so avoids the deadlock-on-filling-pipes problem alluded to above - the current full quote in the documentation is:
Note (on using
Popen.wait
)This will deadlock when using
stdout=PIPE
orstderr=PIPE
and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. UsePopen.communicate()
when using pipes to avoid that.
Current POSIX platform does use wait
and so potentially has problems collecting output; Windows platform uses the os.spawn
interface and os.waitpid
This issue was originally created at: 2005-06-15 23:57:55. This issue was reported by:
blep
.Buildling a project containg error using scons -j 2 leads to the strange error message below. The output bug starts at the line [****]. Looking at it closely, we can see that the first builder starts to report the error, and a few character after, the second also print out the error. This result in the output from two builders being interleaved.
This look like a "common" multi-threading bug were access to the output is not serialized.
Baptiste.
Converted from SourceForge tracker item 1221715
Issue 2067 has been marked as a duplicate of this issue.
Bug party triage.
Issue 1746 has been marked as a duplicate of this issue.
Adjust triage of issues.
fcl said at 2011-07-07 03:48:00
I am considering having a look at this issue as I see it as well on a multi core WS2008R2. I have had a look at the code and as far as I understand the same stdout/stderr is used for all parallel subprocesses.
I am consider the following alternatives:
Like
Popen.wait()
, this will deadlock when usingstdout=PIPE
and/orstderr=PIPE
and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. https://docs.python.org/library/subprocess.htmlAny direction for design of a solution would help. Once I have clear idea of the best design I should be able to implement and test it.
Are there other people running Scons under Windows that are having this issue?
For what it's worth, clearmake does this, and outputs a message saying when it starts processing a build rule, then another message and all the output once it finishes. It takes a little getting used to, but it's a major improvement on getting mixed output.
Thus you get
Votes for this issue: 16.