Boost C++ Libraries: Ticket #994: BJam output with parallel builds jumbled. https://svn.boost.org/trac10/ticket/994 <p> Doing <code>"bjam -j4"</code> creates output that is jumbled, and hence is not possible to parse it out, or even read. To fix need to change the <code>execcmd</code> to use <code>popen</code>, as the <code>SHELL</code> built-in does, storing the output of actions. When an action completes dump the output all at once. Some locking on the output may be needed to make certain the output is serial. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/994 Trac 1.4.3 Rob.Lievaart@… Tue, 29 May 2007 09:41:56 GMT <link>https://svn.boost.org/trac10/ticket/994#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:1</guid> <description> <p> Hi, </p> <p> popen won't do the trick, as it only catches stdout en not stderr(AFAIK). You will need to create your own pipes for stdin,stoud and stderr, and after the fork, move these to the in/out/err filedescriptors before running execvp. (and close any other open fds). Since you would do more then call exec after the fork, vfork can no longer be used. </p> <p> Then in the parent you need to have some kind of select loop waiting on the fd's for all children, and reading and collecting the output from them. And when the process has finished you can dump that to the screen. (waitexec might be the place to do that. </p> <p> And on Win32 with create process, it works, eh, different. Don't know the details, for that, but createprocess is sort of a combination of fork/exec, and you can pass handles for in/out/error to the function. </p> <p> Don't know about any other platforms. </p> <p> Rob Lievaart </p> </description> <category>Ticket</category> </item> <item> <dc:creator>René Rivera</dc:creator> <pubDate>Tue, 29 May 2007 14:41:27 GMT</pubDate> <title>component changed https://svn.boost.org/trac10/ticket/994#comment:2 https://svn.boost.org/trac10/ticket/994#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">Building Boost</span> → <span class="trac-field-new">bjam</span> </li> </ul> Ticket kbelco@… Tue, 29 May 2007 16:09:22 GMT <link>https://svn.boost.org/trac10/ticket/994#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/994#comment:2" title="Comment 2">grafik</a>: Hi Rene, </p> <p> As Rob observed, that's exactly the solution I have implemented. The only concern I have is the overhead of using fork vs. vfork and the need to heap allocate memory when there's output to stderr. I've played around with only keeping the first 4k bytes of warning or error messages to avoid the heap allocation but I'm not sure which solution I prefer just yet. I've also added a signal handler (the handler is registered in jam.c) so the parent process gets notified when the child terminates. </p> <p> Just wanted to let you know that this is almost done for unix. I haven't even looked at changing Win32 code. </p> <p> -- Noel </p> </description> <category>Ticket</category> </item> <item> <author>Rob.Lievaart@…</author> <pubDate>Wed, 30 May 2007 09:03:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/994#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:4</guid> <description> <p> Hi Noel, </p> <p> Allways, nice to see I wasn't talking complete noncense. :-) And thanks for doing the work. My feeling is you shouldn't worry to much about the fork and memory allocation. On Linux a fork does copy on write for all memory, so in this case there should not be to much penalty. Other platforms may have similar solutions. As for the dynamic memory allocation, in general I expect very little output from the (compile) commands, only in case of errors. And compared to a fork/starting of a new process, compiling some C++ code, a few memory allocations will probably not show up at all when profiling. </p> <p> I am just looking at execnt.c, and it is looking a lot more complex. (NOTE: I currently have the boost 1.33.1 sources version on this machine, so that may be a bit outdated) A lot of win95/98 support that can probably be left alone. It uses spawn instead of fork/exec. To correctly handle stdout/stderr this probably has to be replaced with <a class="missing wiki">CreateProcess</a>. <a class="missing wiki">CreateProcess</a> works different so this is not a trivial search/replace operation. Also reading output form the Win32 handles works differently, so it will probably have quite a big impact. </p> <p> Hmm, execmac.c seems like a stub implementation, the function does (allmost) nothing. </p> <p> And execvms.c simply calls system, so no asynchronous support at all. </p> <p> So the last two should be easy :-) Kind Regards, </p> <p> Rob Lievaart. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>René Rivera</dc:creator> <pubDate>Wed, 30 May 2007 16:56:08 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/994#comment:5 https://svn.boost.org/trac10/ticket/994#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I've applied Noel's patch for this to branch "Boost_Jam_994" of the <code>tools/jam</code> directory (Noel, I had to make some minor changes for portability to non-Unix platforms). I'll write up some tests to test the functionality a bit later today. </p> Ticket René Rivera Thu, 31 May 2007 01:18:42 GMT <link>https://svn.boost.org/trac10/ticket/994#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:6</guid> <description> <p> I added a <code>tools/jam/test/parallel_actions.jam</code> test and I'm getting two different error behaviors, when I run it on my Ubuntu Linux machine. First the output from the actions is still jumbled. And second, many times, but not always, the actions don't seem to complete. Or more likely bjam doesn't notice the actions complete. To run the test: </p> <pre class="wiki">cd tools/jam/src ./build.sh cd ../test ../src/bin.*/bjam -f parallel_actions.jam -j4 -sBJAM_SUBTEST=1 </pre> </description> <category>Ticket</category> </item> <item> <author>kbelco@…</author> <pubDate>Thu, 31 May 2007 02:45:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/994#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:7</guid> <description> <p> Hi Rene, </p> <p> I forgot to fix the output so that the command output, if any, immediately follows the command rule name. </p> <p> I want the output to look like this : </p> <p> darwin.compile.c++ bin.v2/libs/thread/build/darwin/release/threading-multi/read_write_mutex.o darwin.compile.c++ bin.v2/libs/thread/build/darwin/release/threading-multi/thread.o </p> <p> [ any / all stdout and stderr messages for thread.o occur here ] </p> <p> darwin.compile.c++ bin.v2/libs/thread/build/darwin/release/threading-multi/tss_hooks.o </p> <p> [ any / all stdout and stderr messages for tss_hooks.o occur here ] </p> <p> darwin.compile.c++ bin.v2/libs/thread/build/darwin/release/threading-multi/tss_dll.o darwin.compile.c++ bin.v2/libs/thread/build/darwin/release/threading-multi/tss.o </p> <p> and so forth. </p> <p> Is this what you were thinking? </p> <p> I can replicate that problem you're seeing on my Mac so I'll work on diagnosing and fixing that first and hope that fixes the Ubuntu problem you're seeing. </p> </description> <category>Ticket</category> </item> <item> <author>kbelco@…</author> <pubDate>Fri, 01 Jun 2007 21:42:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/994#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/994#comment:6" title="Comment 6">grafik</a>: </p> <blockquote class="citation"> <p> I added a <code>tools/jam/test/parallel_actions.jam</code> test and I'm getting two different error behaviors, when I run it on my Ubuntu Linux machine. First the output from the actions is still jumbled. </p> </blockquote> <p> This has been fixed. </p> <blockquote class="citation"> <p> And second, many times, but not always, the actions don't seem to complete. Or more likely bjam doesn't notice the actions complete. </p> </blockquote> <p> This is fixed, no zombies and fixed some performance throughput problems. </p> <blockquote class="citation"> <p> To run the test: </p> </blockquote> <p> I haven't run you tests but I've committed the changes to the CVS branch tag you setup. Let me know if you find any more problems. </p> <p> -- Noel </p> </description> <category>Ticket</category> </item> <item> <dc:creator>René Rivera</dc:creator> <pubDate>Sat, 02 Jun 2007 03:48:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/994#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:9</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/994#comment:8" title="Comment 8">kbelco@sandia.gov</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/994#comment:6" title="Comment 6">grafik</a>: </p> <blockquote class="citation"> <p> I added a <code>tools/jam/test/parallel_actions.jam</code> test and I'm getting two different error behaviors, when I run it on my Ubuntu Linux machine. First the output from the actions is still jumbled. </p> </blockquote> <p> This has been fixed. </p> </blockquote> <p> It seems I was still getting the same behavior on Linux. I fixed it by adding in the dup of both stderr and stdout. </p> <blockquote class="citation"> <blockquote class="citation"> <p> And second, many times, but not always, the actions don't seem to complete. Or more likely bjam doesn't notice the actions complete. </p> </blockquote> <p> This is fixed, no zombies and fixed some performance throughput problems. </p> </blockquote> <p> Yea, looks fixed. </p> <blockquote class="citation"> <blockquote class="citation"> <p> To run the test: </p> </blockquote> <p> I haven't run you tests but I've committed the changes to the CVS branch tag you setup. Let me know if you find any more problems. </p> </blockquote> <p> I found some :-) And fixed them. I need to make a few more changes for the memory allocation. And then we need to figure out how to do the Windows side (yuck). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 02 Jun 2007 05:58:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/994#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/994#comment:10</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/994#comment:6" title="Comment 6">grafik</a>: </p> <blockquote class="citation"> <p> ../src/bin.*/bjam -f parallel_actions.jam -j4 -sBJAM_SUBTEST=1 </p> </blockquote> <p> Rene, </p> <p> I ran this test earlier today and it looked fine but the test jam file was modified sometime this evening and now the results look funny (some of the textual output is missing, looks like the test number). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>René Rivera</dc:creator> <pubDate>Sat, 02 Jun 2007 15:45:21 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/994#comment:11 https://svn.boost.org/trac10/ticket/994#comment:11 <ul> <li><strong>owner</strong> changed from <span class="trac-author">René Rivera</span> to <span class="trac-author">Noel Belcourt</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Noel Belcourt Sat, 02 Jun 2007 16:28:53 GMT owner changed https://svn.boost.org/trac10/ticket/994#comment:12 https://svn.boost.org/trac10/ticket/994#comment:12 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Noel Belcourt</span> to <span class="trac-author">René Rivera</span> </li> </ul> Ticket René Rivera Sat, 16 Jun 2007 20:56:47 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/994#comment:13 https://svn.boost.org/trac10/ticket/994#comment:13 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket