New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 613718 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

tabId is sometimes -1 in webRequest.onErrorOccurred event

Project Member Reported by rob@robwu.nl, May 20 2016

Issue description

After adding some tests ( issue 572930 ), I found that the (locally) the insertMultipleOriginFramesAndImmediatelyRemoveFrames test in test_unload6.js fails quite often due to tabId being -1.

./browser_tests --gtest_filter=ExtensionWebRequestApiTest.WebRequestUnloadImmediately --

The test does the following:
1. Open new page at origin A and wait until it's loaded.
2. Insert a frame at origin A and another frame at origin B (different from A!!!).
3. Remove frame A and B (synchronously after the previous step).
4. Wait for two onErrorOccurred events, and check the result.

When the test fails, this happens:

[FAIL] insertMultipleOriginFramesAndImmediatelyRemoveFrames: API Test Error in insertMultipleOriginFramesAndImmediatelyRemoveFrames
Actual: [{"error":"net::ERR_ABORTED","frameId":1,"fromCache":false,"method":"GET","parentFrameId":0,"tabId":12,"type":"sub_frame"},{"error":"net::ERR_ABORTED","frameId":2,"fromCache":false,"method":"GET","parentFrameId":0,"tabId":-1,"type":"sub_frame"}]
Expected: [{"method":"GET","frameId":1,"parentFrameId":0,"tabId":12,"type":"sub_frame","fromCache":false,"error":"net::ERR_ABORTED"},{"method":"GET","frameId":2,"parentFrameId":0,"tabId":12,"type":"sub_frame","fromCache":false,"error":"net::ERR_ABORTED"}]

Often only the second tabId is -1; occasionally (rarely), even the first tabId is also -1.
This happens with and without --site-per-process.

And in the ~50 times that I ran the test locally, I found that the next test failed too (insertCrossOriginFrameAndImmediatelyRemoveFrame = insert 1 cross-origin frame and remove it).

In all cases, frameId and parentFrameId had meaningful values.

Devlin, this bug might be caused by the 0.15% failures to look up the data on the IO thread, per 1790e82aac659c28dfbd9aac82f1feb4a839f405. I'm going to address this by putting the tabId retrieval logic together with the frameId retrieval logic (where an optional thread hop may occur), you might want to investigate further why tabId is -1 at this point.
 
Cc: nasko@chromium.org
Interesting.  Retrieving the values from the frame id map is also 70x better than it was before.  I wonder if it just made it all more egalitarian, so that it fails both in tests and out of?  A better state to be in, certainly.

I'm also curious as to why it does fail.  In theory, the frame map is keyed into all the places we create a render frame.  +Nasko in case he has thoughts on what could be leaking through the cracks.

Comment 2 by rob@robwu.nl, May 21 2016

Status: Started (was: Assigned)
My suggested approach seems to work. I'll tidy up the patch and upload a CL tomorrow.

A possible explanation is that the resource request IPC (renderer->browser, IO thread) is somehow processed before the RenderFrameHost is registered (in the browser, UI thread, hop to IO thread). I didn't verify this, but it seems plausible.

Comment 4 by rob@robwu.nl, May 24 2016

Status: Fixed (was: Started)
The work-around works, but there is another issue with tabId, see bug 614391.

I suggest to continue the discussion (from comment 1) in the other bug.

Sign in to add a comment