Bug 42710 - Assertion in Connection::readEventHandler when launching WebKitTestRunner
Summary: Assertion in Connection::readEventHandler when launching WebKitTestRunner
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
Keywords: InRadar, PlatformOnly
Depends on:
Reported: 2010-07-20 16:02 PDT by Adam Roben (:aroben)
Modified: 2010-07-21 13:25 PDT (History)
2 users (show)

See Also:

Patch (8.84 KB, patch)
2010-07-21 13:04 PDT, Adam Roben (:aroben)
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2010-07-20 16:02:56 PDT
To reproduce:

1. run-webkit-tests --webkit-test-runner

You'll hit an ASSERT_NOT_REACHED() on launch in Connection::readEventHandler because GetOverlappedResult returned FALSE and GetLastError returned ERROR_MORE_DATA.
Comment 1 Adam Roben (:aroben) 2010-07-20 16:03:11 PDT
Comment 2 Adam Roben (:aroben) 2010-07-21 07:59:00 PDT
MSDN says:

The results reported by the GetOverlappedResult function are those of the specified handle's last overlapped operation to which the specified OVERLAPPED structure was provided, and for which the operation's results were pending.


If a named pipe is being read in message mode and the next message is longer than the nNumberOfBytesToRead parameter specifies, ReadFile returns FALSE and GetLastError returns ERROR_MORE_DATA. The remainder of the message can be read by a subsequent call to the ReadFile or PeekNamedPipe function.

So we must be sending a message that's more than inlineMessageMaxSize (4096) bytes.
Comment 3 Adam Roben (:aroben) 2010-07-21 08:01:12 PDT
Indeed, we're sending a message that's 9128 bytes.
Comment 4 Adam Roben (:aroben) 2010-07-21 08:10:33 PDT
I added an (incorrect, but useful for debugging) assertion to Connection::sendOutGoingMessage:

    ASSERT(arguments->bufferSize() < inlineMessageMaxSize);

This assertion does get hit.

It looks like the message being sent has an ID of 0x00050003, which I think corresponds to WebProcessProxyMessage::PostMessage.

Sam thinks that this is likely the render tree dump being sent from the web process to the UI process.
Comment 5 Adam Roben (:aroben) 2010-07-21 10:58:40 PDT
I think our existing ReadFile code is a little wrong. MSDN says:

Use NULL for [lpNumberOfBytesRead] if this is an asynchronous operation to avoid potentially erroneous results.

But we're not doing that. I think we're supposed to call GetOverlappedResult to get the number of bytes read even if ReadFile returns TRUE.
Comment 6 Adam Roben (:aroben) 2010-07-21 13:04:30 PDT
Created attachment 62224 [details]
Comment 7 Adam Roben (:aroben) 2010-07-21 13:25:58 PDT
Committed r63852: <http://trac.webkit.org/changeset/63852>