Fix Bug 1450875 - Wait for Sections to be added before broadcasting content#4086
Fix Bug 1450875 - Wait for Sections to be added before broadcasting content#4086piatra merged 2 commits intomozilla:masterfrom
Conversation
|
The line that is failing was added in #4022 more than a month ago: Before the change #3695 was doing a different type of access but probably would have run into an exception too: activity-stream/system-addon/lib/HighlightsFeed.jsm Lines 116 to 117 in 8850b8b So something other than those changes must have caused this exception to start appearing. The earliest failures seem to be from 8 days ago which seems to suggest a change from bug 1449792 export 837cea5...6170061 My guess is @sarracini's changes for #4059 where in particular, Perhaps it's triggering more refreshes than desired now… ? Also, looking at the taskcluster logs, it doesn't seem to necessarily fail on startup as other tests seem to have passed okay. Perhaps the added debouncing logic is causing a continuation after things have uninitialized somehow? This looks like a regression, so we need to figure out how to reproduce the issue so we can track down what change is causing the problem and then we can figure out how to fix the cause or avoid it. |
|
I happened to trigger a try with a m-c merge from today, but I wasn't able to reproduce this with logging after 800 retries: Although looking at the logs when printing: o.push(`${action.type} ${(d => d.id || d.name || Object.keys(d))(action.data || {})}\n`);
if (action.type === "SECTION_UPDATE") o.push(Error().stack.split("\n").slice(6, 10));Where the SECTION_UPDATES are triggered by:
The first 2 seem to be normal startup stuff. #3 might be test runner / new profile behavior? And the rest I'm guessing are test specific (although it's somewhat wasteful that Highlights refreshes on CLEARED only to refresh immediately after when top sites also decides to refresh on CLEARED). I believe we're assuming the problem is that SECTION_REGISTER highlights gets delayed until after TOP_SITES_UPDATED. Looking more closely at how that could happen, I think it's #4058 that made SectionsManager's
activity-stream/system-addon/lib/SectionsManager.jsm Lines 126 to 138 in 2e41605 |
|
I could move all indexedDB access to |
|
Interesting. Was looking at bug 1454110 and locally it triggers the exception in this bug every time. Seems random but locally the failure reproduces every time. Actually this was already caught by pine. https://treeherder.mozilla.org/#/jobs?repo=pine&revision=f94e1f89458832840e6fe71d0ff625ec228eb895&selectedJob=174021107 Everything is orange. |
Mardak
left a comment
There was a problem hiding this comment.
Add a comment and rebase. I think this should be fine. The failure situation is top sites updates before highlights is registered. Highlights wants top sites for deduping. If Highlights is slow, it'll return early with this change, and when it does register and refresh via postInit, it'll have top sites to dedupe against, and there's no user facing change.
|
Oh, and to be clear, I don't think we need to change the timing / chaining issues related to init / prefs / registering / top sites now with this fix. We'll probably want a test to help ensure highlightsfeed doesn't break if its postInit happens after top sites. |
It looks like the
SectionsManagerdoes not initialise/add the sections untilPREFS_INITIAL_VALUESbecause prefs are required for sections.PREFS_INITIAL_VALUESis triggered afterINIT, butINITalso triggers Topsites to update and afterwards the HighlightsFeed. If the SectionsManager hasn't finished before theHighlightsFeed.fetchHighlightscall, then we run into this issue.I wasn't able to reproduce, what I did was add an
awaitcall for a promise resolved in asetTimeoutinaddBuiltInSection.I propose that we just return early if we don't have the sections available yet because when they finally become available the feed will trigger the postInit fetch
This is just a WIP to open the discussion.
@Mardak thoughts?