Closed Bug 2072785 Opened 2 months ago Closed 1 month ago

Investigate why APZ sometimes reaches the content response timeout even when it's very long

Categories

(Core :: Panning and Zooming, task, P2)

task

Tracking

()

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: botond, Assigned: botond)

References

Details

Attachments

(1 external file)

In bug 2067573, a user reported experiencing scrolling breaking across all tabs after using a map application such as Google Maps.

The investigation in that bug revealed that the reporter had the apz.content_response_timeout pref set to 60000, and reverting the pref value to the default of 400 restored normal scrolling behaviour.

While the issue has been resolved from the reporter's point of view, I'm concerned that these symptom may point to one or more other underlying issues that deserve further investigation.

The fact scrolling broke across all tabs suggests that the input queue was stalled, i.e. an event was waiting in the queue for a content response, and that content response did not arrive for an extended period of time. This should only legitimately happen if the target page is running some slow script that's holding up the content response, and once we get to a timescale of several seconds, it should basically never happen.

The fact that the input queue remained stalled for an ongoing period of time suggests that rather than the content response merely being slowed down by a slow script, it was rather dropped (and so the queue remained stalled until the timeout, which here was 60 seconds, was reached).

A content response being dropped is problematic, as it means APZ is waiting for it until the timeout is reached; while at the default pref value of 400, it "only" waits for 400ms, that's still long enough that we'd like to understand and fix the underlying issue.

Suggested investigative approach:

  • Set apz.content_response_timeout to 60000 locally
  • Browse around, including using map applications
  • If we can reproduce an input queue stall, investigate what happened to the content response
See Also: → 2072786

Botond, given that I saw this problem as well what could be done at the point when the problem is seen? I saw that you posted some steps on bug 2067573 comment 8 and a recorded profile was shared on bug 2067573 comment 10 but in your following comment you didn't referred to it. Maybe you can check again if there is something useful in it?

Flags: needinfo?(botond)

I could reproduce the issue relatively steadily.

  1. Set apz.content_response_timeout to 60000 on Nightly
  2. Open a scrollable page
  3. Open https://www.google.com/maps on a new tab (now you have two tabs)
  4. On google map, repeat zooming in and out by either scroll or pinch gesture
  5. Change the tab and check if scroll freezes
  6. When scroll freezes on a tab, it backs to normal after around 60 seconds

If you increase the number of tabs, you can find that, when the issue occurs, scroll freezes across all tabs and even in the vertical tab area.

Note that even when the issue occurs, the map still can be zoomed in and out. So the issue cannot be detected unless you move to another tab.

FYI, I used 158.0a1 on a MacBook.

I have a hypothesis for what is causing the content response to be dropped: the Mac widget code drops zero-delta wheel events here. This is after the event has been sent to APZ (so it's been added to the input queue) and before sending it to the content process (so a content response for such events will never be generated, and so on pages with active wheel event listeners the event will remain in the queue until the timeout is reached).

Everything I've seen so far is consistent with this hypothesis:

  • The Linux widget code has no such check, and I can't reproduce the issue on Linux. However, if I add a similar check to the Linux widget code here, I can reproduce the issue somewhat readily.
  • Kanaru could reproduce the issue on his Mac as mentioned in comment 2, but after locally removing the check referenced above, he no longer could.
  • The reports of the stall being observed in bug 2067573 and bug 2070448 were both on Mac.

I've looked at the history of the code to see if I can find some reasoning for the check to drop zero-delta events, but it's been there since the introduction of APZ support for touchpad scrolling on Mac. I'm going to try removing the check.

Assignee: nobody → botond
Flags: needinfo?(botond)

At the time of this check, the event has already been sent to APZ,
so on a page with an active wheel event listener, it's sitting in
the input queue waiting for a content response. If we drop it at
this point, the content response will never arrive, and the event
will stall the input queue until the apz.content_response_timeout
is reached.

The alternative of dropping zero-delta events before they reach
APZ would have a different problem: touchpads can legitimately
generate zero-delta events for things like hold gestures, and APZ
wants to know about these.

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 159 Branch
QA Whiteboard: [qa-triage-done-c160/b159]
Regressions: 2086786
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: