[Scons-users] 回复: Scons-users Digest, Vol 144, Issue 8

Steve Hill (Wireless) Steve.Hill1 at viavisolutions.com
Tue Sep 26 08:29:22 EDT 2023


As Mats has said, the issue is not restricted to Python - all spawned process can also output to stdout and, by default, all this output can interleave in arbitrary ways. We've got round this by overloading the function used to spawn a sub-process such that it captures the output from the tool and outputs it to stdout only having taken a Lock that is used for all output during the build phase. This has the added advantage that, for some tools that are very chatty and don't provide a way to quieten them down, we can filter out the noise and only output the parts that are useful information for the user.

S.

-----Original Message-----
From: Scons-users <scons-users-bounces at scons.org> On Behalf Of Mats Wichmann
Sent: Monday, September 25, 2023 6:28 PM
To: SCons users mailing list <scons-users at scons.org>
Subject: Re: [Scons-users] 回复: Scons-users Digest, Vol 144, Issue 8

EXTERNAL EMAIL: Do not click links or open attachments unless you know and trust the sender.


On 9/25/23 08:54, Eric Fahlgren wrote:
> On Mon, Sep 25, 2023 at 3:23 AM Yu,Zhiwei (YFI,Shanghai,CN) 
> <zhiwei.yu at yanfeng.com <mailto:zhiwei.yu at yanfeng.com>> wrote:
>
>     Hi Guys,
>
>              I find that if I set -j8, the printing messages sequence
>     will be disordered.
>              I think the reason is python print buffer has competition
>     in multithreading. Am I right?
>              And how can I resolve it.
>
>
> As each subprocess has something to say, it says it.  This is normal 
> and expected for anything other that -j1.  If you have a requirement 
> that the output messages be sequential, then your only solution is to 
> turn off multiple subprocesses and use -j1.

It's not clear exactly what the problem is.  Will add these notes:

* SCons chooses the build order to best resolve the depndency graph.
That means things may not be built in the order you expect - that's one possible form of out-of-order, and nothing to worry about.

* SCons prints its own message for each action, if those are too noisy you can change what it prints, which might look clearer (if you don't need the details).  Those messages should not interfere with one another, as those are happening inside Python.

* SCons has no control at all over what external commands output or when they do, so those might indeed interleave, it multiple theads are in use.  For many commands, they don't actually say anything unless something is wrong, but some are more talkative.
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://urldefense.com/v3/__https://pairlist4.pair.net/mailman/listinfo/scons-users__;!!Niha4SQ!8DFMhe-xBuct_VbHF8evvWm7JbYsnsbMRSvV2N1nhGWN5ErmmuF0kZKEUINOlQW1wMSYrmFoxmOmNkF8qobUjsj5$


More information about the Scons-users mailing list