<div dir="ltr">That change did successfully fix the TestAttachResume.py failure.<div><br></div><div>This one is a bit different and looks like we may have perturbed something related to shutdown:</div><div><br></div><div>TestHelloWorld.py:</div>
<div><br></div><div><div><font size="1" face="courier new, monospace">Executing tearDown hook: def cleanupSubprocesses(self):</font></div><div><font size="1" face="courier new, monospace"> # Ensure any subprocesses are cleaned up</font></div>
<div><font size="1" face="courier new, monospace"> for p in self.subprocesses:</font></div><div><font size="1" face="courier new, monospace"> if p.poll() == None:</font></div><div><font size="1" face="courier new, monospace"> p.terminate()</font></div>
<div><font size="1" face="courier new, monospace"> del p</font></div><div><font size="1" face="courier new, monospace"> del self.subprocesses[:]</font></div><div><font size="1" face="courier new, monospace"> # Ensure any forked processes are cleaned up</font></div>
<div><font size="1" face="courier new, monospace"> for pid in self.forkedProcessPids:</font></div><div><font size="1" face="courier new, monospace"> if os.path.exists("/proc/" + str(pid)):</font></div>
<div><font size="1" face="courier new, monospace"> os.kill(pid, signal.SIGTERM)</font></div><div><font size="1" face="courier new, monospace"><br></font></div><div><font size="1" face="courier new, monospace"><br>
</font></div><div><font size="1" face="courier new, monospace">python: /mnt/ssd/work/git/gen/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp:427: virtual void ProcessPOSIX::SendMessage(const ProcessMessage&): Assertion `thread' failed.</font></div>
<div><font size="1" face="courier new, monospace">Aborted (core dumped)</font></div></div><div><font size="1" face="courier new, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">I'm having a look at that core now.</font></div>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 10:00 AM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I built clean and ran tests error free on r205315.</div><div><br></div><div>After testing with the patch applied, I'm getting the following failures (3 times in a row):<br>
</div><div><br></div><div>
<div><font face="courier new, monospace" size="1">FAIL: LLDB (suite) :: TestHelloWorld.py (Linux <a href="http://tfiala2.mtv.corp.google.com" target="_blank">tfiala2.mtv.corp.google.com</a> 3.2.5-gg1336 #1 SMP Thu Aug 29 02:37:18 PDT 2013 x86_64 x86_64)</font></div>
<div><font face="courier new, monospace" size="1">FAIL: LLDB (suite) :: TestAttachResume.py (Linux <a href="http://tfiala2.mtv.corp.google.com" target="_blank">tfiala2.mtv.corp.google.com</a> 3.2.5-gg1336 #1 SMP Thu Aug 29 02:37:18 PDT 2013 x86_64 x86_64)</font></div>
</div><div><br></div><div>Looking deeper, it looks like the main.c code in test/functionalities/attach_resume/main.c is assuming c99 mode which isn't the default when using gcc. I'm clearing that locally (pulling for loop variable declarations out) and will see if that fixes everything else.</div>
<div><br></div><div>Back in a bit...</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 9:06 AM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Having a look at this now.</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Mar 27, 2014 at 1:01 AM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Todd, and no problem on the unit test, I'll try to include one for anything I come across in the future as well.<br>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 10:39 PM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ah nice. I'll definitely run this again soon. Thanks for getting a test around it - we can't have enough of that around important expectations.</div>
<div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Mar 26, 2014 at 2:06 PM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Ok that makes sense. I've updated the patch I sent yesterday with a unit test that exposes the problem as well as a couple of other process attach issues that were fixed in the last few days. It was in fact this getpgid() issue that was causing problems when trying to create a unit test earlier as the problem scenario occurs when the unit test script forks a subprocess with popen().<br>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 7:20 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
On Mar 25, 2014, at 12:09 PM, Andrew MacPherson <<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</a>> wrote:<br>
<br>
> Ok great, I'm attaching a patch here that just uses getpgid() to determine the pgid to use with waitpid(). I get the same unit test results before and after the patch (there are a few tests that fail consistently for me). I tried using a simple -1 with waitpid() but this results in a hang in the unit tests. This is probably something worth investigating but for now this patch does resolve the issues around waitpid() when attaching.<br>
<br>
</div>We should never use -1 with waitpid() as you could end up reaping a process that someone else is already trying to reap. You must only try to reap the process that you launched using some pid for you process. Many things launch processes within LLDB like ProcessGDBRemote launching "debugserver" binaries. The ProcessGDBRemote must be notified when and if "debugserver" crashes, so if anyone else does waitpid(-1, ...) ProcessGDBRemote might never find out if debugserver crashes for some reason.<br>
<div><br>
> I mentioned a few issues I ran into with the unit tests in the email I just pinged with a Linux detach patch, basically there appears to be a bug or limitation somewhere in that doing a "continue" in asynchronous mode in a unit test breaks things and this is needed for most attach-related debug testing. I can probably look into this (along with the couple of failing tests I have) but likely won't be able to this week. I haven't filed a bug for the consistently-failing tests on my end since it doesn't appear to be happening for others and I haven't had a chance to investigate here, let me know if I should file a bug anyway.<br>
><br>
><br>
> On Tue, Mar 25, 2014 at 6:30 PM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
> I'd suggest trying the change, running the tests, and see if anything new fails.<br>
><br>
> And if this fixes currently broken behavior, add a test to make sure we don't regress it. I'm pretty sure if it breaks something we'll know pretty quickly (either via bugs or our own usage). At which point - we should add a test so we don't regress in the future and perhaps add a few comments as to the reason.<br>
><br>
><br>
> On Tue, Mar 25, 2014 at 9:54 AM, <<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>> wrote:<br>
> Why are you waiting for process groups? That's not something we have to do on Mac OS X.<br>
><br>
> Jim<br>
><br>
><br>
> On Mar 25, 2014, at 1:17 AM, Andrew MacPherson <<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</a>> wrote:<br>
><br>
> > Currently under Linux if you attach to a process whose process group id is not equal to its process id (such as the child process of a fork() call) the calls to waitpid() that pass -1*pid will return ECHILD since the pid argument refers to a process group that doesn't exist. These calls occur in Host::MonitorChildProcessThreadFunction() and the Linux ProcessMonitor.<br>
> ><br>
> > Changing -1*pid to simply -1 or to -1*getpgid(pid) resolves the issue but it's not clear if this is the right fix as I'm unsure how other OSes deal with this scenario.<br>
> ><br>
> > Any thoughts?<br>
> ><br>
> > Thanks,<br>
> > Andrew<br>
> > _______________________________________________<br>
> > lldb-dev mailing list<br>
> > <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
><br>
><br>
><br>
> --<br>
> Todd Fiala | Software Engineer | <a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a> | <a href="tel:650-943-3180" value="+16509433180" target="_blank">650-943-3180</a><br>
><br>
><br>
</div>> <waitpid-getpgid.patch>_______________________________________________<br>
<div><div>> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table style="color:rgb(136,136,136);font-family:'Times New Roman'" cellpadding="0" cellspacing="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" nowrap>Todd Fiala |</td><td style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" nowrap> Software Engineer |</td>
<td style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" nowrap> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" nowrap><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>