Bug 36377 - new-run-webkit-tests doesn't detect wedged tests.
Summary: new-run-webkit-tests doesn't detect wedged tests.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Dirk Pranke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-19 11:11 PDT by Michael Moss
Modified: 2011-03-29 18:12 PDT (History)
3 users (show)

See Also:


Attachments
Patch (5.56 KB, patch)
2010-03-19 11:13 PDT, Michael Moss
no flags Details | Formatted Diff | Diff
Patch (5.93 KB, patch)
2010-03-19 12:07 PDT, Michael Moss
no flags Details | Formatted Diff | Diff
Patch (5.96 KB, patch)
2010-03-22 11:57 PDT, Michael Moss
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Moss 2010-03-19 11:11:50 PDT
Layout test framework doesn't detect wedged tests.
Comment 1 Michael Moss 2010-03-19 11:13:06 PDT
Created attachment 51170 [details]
Patch
Comment 2 Ojan Vafai 2010-03-19 11:24:53 PDT
Comment on attachment 51170 [details]
Patch

> +++ WebKitTools/ChangeLog	(working copy)
> @@ -1,3 +1,13 @@
> +2010-03-19  Michael Moss  <mmoss@chromium.org>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Add layout_tests handling for unresponsive (but not dead) tests.

It's not clear how unresponsive and dead tests are different. Can you add a bit more description explaining that sometimes the the test_shell_thread itself gets hung when running a test? This is to clarify as opposed to a test that just never finishes or that hangs the TestShell/DRT process, both of which are already handled.

Code changes look good.
Comment 3 Dirk Pranke 2010-03-19 12:03:54 PDT
Comment on attachment 51170 [details]
Patch

I'm not wild about this patch, simply because it checks for a wedged thread at (potentially) the wrong layer.

If you compare the chromium and mac implementations of driver.run_test, you'll see that the mac version actually implements non-blocking reads from DumpRenderTree, so that (in theory) it shouldn't ever wedge up. If we're seeing test_shell wedge up, I would probably be happier to change the Chromium implementation to do the same thing. We could probably refactor the non-blocking code into common logic shared in port/base.py.

In particular, this patch won't fix a wedged run if you run with --num-test-shells=1 (which runs the whole thing in a single thread).

On the other hand, we could decide that it's safer and more generic to do this at the thread-management layer (that way we can handle a wedged python thread regardless of what it's doing). But I would prefer to be clear about this rather than potentially be working around the same underlying problem two different ways.
Comment 4 Michael Moss 2010-03-19 12:07:40 PDT
Created attachment 51178 [details]
Patch
Comment 5 Michael Moss 2010-03-19 14:43:53 PDT
(In reply to comment #3)
> (From update of attachment 51170 [details])
> I'm not wild about this patch, simply because it checks for a wedged thread at
> (potentially) the wrong layer.
> 
> If you compare the chromium and mac implementations of driver.run_test, you'll
> see that the mac version actually implements non-blocking reads from
> DumpRenderTree, so that (in theory) it shouldn't ever wedge up. If we're seeing
> test_shell wedge up, I would probably be happier to change the Chromium
> implementation to do the same thing. We could probably refactor the
> non-blocking code into common logic shared in port/base.py.

Does O_NONBLOCK work on Windows? chromium.py is used on mac/linux/win.

> In particular, this patch won't fix a wedged run if you run with
> --num-test-shells=1 (which runs the whole thing in a single thread).

Yeah, I missed that usage.

> On the other hand, we could decide that it's safer and more generic to do this
> at the thread-management layer (that way we can handle a wedged python thread
> regardless of what it's doing). But I would prefer to be clear about this
> rather than potentially be working around the same underlying problem two
> different ways.

If O_NONBLOCK doesn't work, then this would still have the issue with --num-test-shells=1, right? Or is that not a big deal since --num-test-shells=1 is more of a debugging mode, and at least the buildbots would be able to recover better?
Comment 6 Dirk Pranke 2010-03-19 15:52:31 PDT
(In reply to comment #5)
> Does O_NONBLOCK work on Windows? chromium.py is used on mac/linux/win.

Ooo, good question. It looks like the interweb is mixed in opinions on this; select() works on sockets, but I don't know if Windows pipes to a subprocess are considered sockets, and I don't know if fcntl will work but I'm not optimistic.

So, it may be that your approach is best and we'll have to expect num-test-shells=1 to potentially wedge (and maybe I can rip the non-blocking code out of the mac port).

We should at least check to make sure that you didn't do anything that causes num-test-shells=1 to outright break in the normal (non-wedging) case.

There's a PEP out for better non-blocking communication, but I'm not gonna hold my breath for that.
Comment 7 Michael Moss 2010-03-19 16:06:02 PDT
> We should at least check to make sure that you didn't do anything that causes
> num-test-shells=1 to outright break in the normal (non-wedging) case.

unwedge() is only called in the _run_tests() threads loop, which num-test-shells=1 completely bypasses.
Comment 8 Michael Moss 2010-03-19 16:08:40 PDT
(In reply to comment #7)
> > We should at least check to make sure that you didn't do anything that causes
> > num-test-shells=1 to outright break in the normal (non-wedging) case.
> 
> unwedge() is only called in the _run_tests() threads loop, which
> num-test-shells=1 completely bypasses.

Err, I mispoke. It doesn't bypass, but it finishes before it hits the loop, since all the processing happens in _instantiate_test_shell_threads().
Comment 9 Michael Moss 2010-03-22 11:57:24 PDT
Created attachment 51324 [details]
Patch
Comment 10 Dirk Pranke 2010-03-23 14:07:34 PDT
Comment on attachment 51324 [details]
Patch

it would be good if we could change the test results from CRASH to TIMEOUT if we had to kill the test shell to unwedge it, but I don't think you need to do that as a part of this patch. Please file a separate bug and I'll take a look at that if you don't want to.

Otherwise, this looks good to me.
Comment 11 Michael Moss 2010-03-23 14:29:15 PDT
(In reply to comment #10)

Actually, I've been testing this on a Mac bot, and it's still not working quite right. unwedge() is triggering as expected, but it seems that some processes are so horribly wedged that 'kill' isn't always working, so run_webkit_tests can still hang until it's killed by the bot. I'm going to debug this some more and send another patch.
Comment 12 Eric Seidel (no email) 2010-04-01 23:38:50 PDT
Comment on attachment 51324 [details]
Patch

r- based on Michael's comments.
Comment 13 Dirk Pranke 2011-03-29 18:12:29 PDT
closing ... the latest version of the code does detect wedges.