Open Bug 1533059 Opened 9 months ago Updated 3 months ago

raptor-tp6m-amazon-search-fennec, raptor-tp6m-wikipedia-fennec, and raptor-tp6m-espn-fennec timeouts


(Testing :: Raptor, defect, P2)

Version 3


(Not tracked)



(Reporter: rwood, Assigned: rwood)



The following Raptor tests are intermittently (quite often) not working on Fennec:


I tried several things including increasing the page-load timeout to a huge number like 3 minutes; changing the 'onload' to 'addEventListener'; and changing what measurements are being taken; but none of those had any effect.

I do notice that if you manually select the Raptor test tab on fennec and then manually choose to refresh the tab in fennec, then the page loads fine and the measurements are retrieved and the rest of the page-cycles work great.

Without that manual refresh it looks like for some reason the Raptor extension measure.js is not being injected into the test tab. This to me points to an issue with fennec itself, not loading the page on the first attempt perhaps.

Also tried running Raptor on fennec in the default tab (instead of opening a new tab; this is how the tests run on the geckoview example app and reference browser, just in the default tab) but the URL won't load on the fennec default tab because of the fennec start page.

Note that another issue in Fennec is the create tab API doesn't make the new tab active by default. Even tried passing in 'active = True' to the tabs.create API (which shouldn't be required as it is supposed to be active by default) but no effect. So when running the tests locally if you want to see them you need to manually select the 2nd tab in Fennec just FYI.

:acreskey, would you or someone on your team have a chance to look at this? I believe it is some problem with Fennec on first load of the test pages, but just a theory at this point.

Flags: needinfo?(acreskey)
See Also: → 1533064

:rwood, I can certainly try to isolate the problem.
I got raptor running on geckoview with this command, can you provide the arguments for fennec?
./mach raptor-test --test raptor-tp6m-1 --app=geckoview --binary="org.mozilla.geckoview_example"

(In reply to Andrew Creskey from comment #2)

Hey Andrew, thank you, much appreciated, and yes:

./mach raptor-test --test raptor-tp6m-amazon-search-fennec --app fennec --binary org.mozilla.fennec_aurora

That's using Fennec (target.apk) from treeherder's Android 4.0 API 16+ opt build task.

Thanks Rob -- but I must be missing something, I only see the speedometer test for fennec:*

(In reply to Andrew Creskey from comment #4)

Thanks Rob -- but I must be missing something, I only see the speedometer test for fennec:*

Ah yes sorry it hasn't landed yet - you'll need to apply the patch here first:

Thanks Andrew

Thanks, I can now reproduce the problem locally (it's 100% on my emulator).

It looks like measure.js doesn't get run until after the page is loaded, so the window.onload event has already fired before we attached to it.

But this same logic works for raptor-tp6m-google-fennec ... strange.
I'll debug more tomorrow.

I think I found the issue:

The raptor webextension injects the js at the default time which is "document_idle".
See the run_at property of the content scripts:

I changed the run_at to document_end and I'm seeing the measure.js run correctly on raptor-tp6m-amazon-search-fennec and other fennec tp6 sites.

i.e. added "run_at": "document_end" here

If this holds it could explain some other problematic sites on other platforms - document_idle may arrive after the load event has fired.

Flags: needinfo?(acreskey)

Wow, that's really interesting thanks Andrew! Ok, I'll put a patch together trying out switching to "run_at: document_end" and see how that looks.

Assignee: nobody → rwood
Blocks: 1533454

(In reply to Robert Wood [:rwood] from comment #9)

The initial try run with this change (as to when Raptor content is injected) appears to have caused issues with tp6-10 (paypal). Re-based and pushed to try again:

It looks like the initial page load is timing out waiting for any of metrics. I can reproduce this locally, even with a fresh mitmproxy recording. Running with --debug shows "awaiting results..." in the console and then nothing else. Is it possible that document_end can also be after the timing events?

Flags: needinfo?(acreskey)

Interesting -- and it looks like paypal is the only site where this is failing, right?

I can run a simple webextension with "run_at": "document_end" on and it behaves correctly, catching the load event.

But let me rebuild and try this in raptor.

By the way, I find that the source documentation for run_at is more descriptive than the web docs:

Hmm, I pulled the latest for OSX and I'm seeing this error when trying to run ./mach raptor-test --test raptor-tp6-paypal-firefox
Any ideas? Like the configuration doesn't have a recordings field?

I can run other tests like ./mach raptor-test --test raptor-speedometer

^^ A clean build removed that error.

So on PayPal it looks like the window.onload function is being set after measure.js is executed, so the custom function that's being assigned is lost. (Looking at the PayPal source they do indeed assign a function to window.onload.)
So it looks like a timing issue with the site.

I refactored measure.js to add raptorContentHandler as load event listener (as we discussed in Bug 1528055), and similarly for runner.js on load function.

This is working locally, so I pushed it to try:

This does feel a bit like a whack-a-mole, but at least personally I think the above solution is correct.
We'll have to see what the try server says....

Flags: needinfo?(acreskey)


And that push times out on raptor-tp6-google-firefox (hero) on Linux64 and raptor-tp6-imgur-firefox (fcp, fnb paint, dcf, ttfi) on OSX.

Locally (OSX) those tests both succeed.

Bug 1536758 is tracking switching to the event listener.

Push to try with run_at: document_start (might as well try out the last available run_at option:

I made a test for document_start vs document_end on geckoview and seems like document_end has generally better times:

Deferring any changes here to Bug 1536758 - Switch to using event listener instead of overloading window.onload in runner/measure.js

Depends on: 1536758
No longer blocks: 1532545
Depends on: 1546323

Hi Alex, once you get the Fennec fix landed (Bug 1546323) can you please verify that this issue is resolved / these tests work on Fennec? Thanks!

Flags: needinfo?(alexandru.ionescu)

Hi Rob, sure!

Flags: needinfo?(alexandru.ionescu)
Priority: P1 → P2

:alex is this done?

Flags: needinfo?(alexandru.ionescu)

I did a fresh try to make sure all is good.

Flags: needinfo?(alexandru.ionescu)
You need to log in before you can comment on or make changes to this bug.