<div dir="ltr">Honestly, lit should just create temp files and get out of the business of polling and reading from subprocess pipes.<div><br></div><div>I think you have more or less diagnosed the problem, with the caveat that communicate will not block because the underlying pipes of that process are full. It is more likely that some other process is blocked writing to a full pipe, and the process under communication is also waiting on that pipe. Consider this pipeline:</div><div>  llc -debug -mtriple=x86_64-linux < %s | FileCheck %s</div><div><br></div><div>In this case, llc will dump lots of text to stderr, which is piped to lit. That buffer will fill and writes will block. lit will 'communicate' with FileCheck, and no progress will be made.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 26, 2015 at 9:57 AM, Sumanth Gundapaneni <span dir="ltr"><<a href="mailto:sgundapa@codeaurora.org" target="_blank">sgundapa@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal">     I am observing a deadlock with llvm-lit on windows 7.<u></u><u></u></p><p class="MsoNormal">When I attached a debugger, the communicate() call is blocked.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">In file utils/lit/lit/TestRunner.py<u></u><u></u></p><p class="MsoNormal">>    # FIXME: There is probably still deadlock potential here. Yawn.<u></u><u></u></p><p class="MsoNormal">>   procData = [None] * len(procs)<u></u><u></u></p><p class="MsoNormal">>    procData[-1] = procs[-1].communicate()<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am invoking python directly on windows to run the unit tests. <u></u><u></u></p><p class="MsoNormal">C:\Python27\python.exe C:\build\llvm\Release\bin\llvm-lit.py -v -j 12 --param build_mode=Release --param build_config=Win32 llvm_site_config=C:\llvm_on_win\nightly\build\llvm\tools\polly\test\lit.site.cfg test<u></u><u></u></p><p class="MsoNormal">Note: If I invoke with “-j 1” , the unit tests finish but took a lot of time. There is no deadlock. I am using python version 2.7.6.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">At this moment, I believe the issue is caused by stdout filling the OS buffer there by blocking the communicate() call.<u></u><u></u></p><p class="MsoNormal">It is possible some of the unit tests dump a lot of text/data to stdout. FYI, I have a couple of unit tests of my own in the code base.<u></u><u></u></p><p class="MsoNormal">On Linux, there is no deadlock but on windows I am hitting a deadlock 7 out of 10 times. I tried invoking python with “-u” but in vain.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">When I looked at llvm-lit code, I saw the code to avoid deadlocks but there was no guarantee, like the one I pasted above.<u></u><u></u></p><p class="MsoNormal">Would appreciate if some one take a look at it and provide more context on deadlocks.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">--Sumanth G<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>