<div dir="ltr">How does this look?<div><br></div><div>If only there were an alternative word besides timeout so that everything lines up.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 4:17 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(You may still want to verify that there's no objections from other stakeholders whose platforms aren't supported by the "timeout" command though.)<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Mon Dec 01 2014 at 4:16:04 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote">On Mon Dec 01 2014 at 4:05:25 PM Chaoren Lin <<a href="mailto:chaorenl@google.com" target="_blank">chaorenl@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">"</span><span style="font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:19.7999992370605px">timeout 5m %s %s/dotest.py %s -p %s %s" will kill python after 5 minutes, but will it also kill any inferiors, and descendants of those?  And what if you have A > B > C, and B dies, then you kill A's tree?</span></blockquote><div><br></div></div><div dir="ltr"><div>As far as I can tell with my experimentation, timeout actually handles all of those cases perfectly. </div></div><div dir="ltr"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">launching the process in a process group ("job" on windows)</span></blockquote><div><br></div></div><div dir="ltr"><div>Could we do that portably?</div></div><div dir="ltr"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:12.8000001907349px">If it's not important then it seems like just running the process in a separate thread with a timeout would be sufficient.</span></blockquote><div><br></div></div><div dir="ltr"><div>I think it's important. Since otherwise you'll finish the test but still end up with a bunch of processes taking up resources in the background. </div></div></blockquote><div><br></div></div><div class="gmail_quote"><div>I thought about it some more, and I think the best solution will be to have a python extension module that implements timeout on each platform.  Then we could use it like this:</div><div><br></div><div>import timeout</div><div><br></div><div>timeout.run("5m", program, **args)</div><div><br></div><div>On Linux and FreeBSD, this would jsut call the system command, and on Windows it would create the process in a job from a separate thread with timeout, and kill the parent process if the tiemout expires, and on OSX it could do something else.  For any platform which doesn't provide an implementation, it could just run the process normally.</div><div><br></div><div>This doesn't matter for Windows at the moment since we don't have a Windows bot anyway, so if you want to check in the original patch for the time being, that's fine (as long as it's behind an OS check, so I don't get errors about the timeout command not existing) and we can do the module once we actually need it.</div><div><br></div><div>It's still not platform independent, but at least all the platform specific stuff will be isolated to its own module, and it would be nice to introduce a place where platform specific python code could live behind a platform agnostic abstraction anyway.  There's already a lot of platform specific stuff in lldbtest.py that would be great to abstract away.</div></div></blockquote></div>
</div></div></blockquote></div><br></div>