Open
Bug 2094473
Opened 10 days ago
Updated 10 days ago
Time out speculation rules prefetches that take too long to complete
Categories
(Core :: DOM: Networking, enhancement, P3)
Core
DOM: Networking
Tracking
()
NEW
People
(Reporter: smayya, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Bug 2093286 limits how many speculation rules prefetches a document can have in flight at once (dom.speculation_rules.max_inflight_prefetches_per_document, default 3). Further prefetch records are queued in WindowGlobalParent and started when an in-flight one completes, fails or is canceled.
Gecko has no overall time limit on a prefetch fetch. A record stays in flight until its channel finishes, so a slow or unresponsive server can hold an in-flight slot for a long time and stall every queued prefetch of the document behind it. Only the generic Necko limits apply:
network.http.connection-timeout(90 s) while connecting.network.http.response.timeout(300 s) while waiting for the first response bytes.- A response that trickles in slowly hits neither, and is only stopped by the 5 MB body cap (
dom.speculation_rules.max_body_bytes), so it can hold a slot until the document goes away.
Chrome cancels a prefetch that has not completed within 10 s (prefetch_timeout_ms in content/browser/preloading/prefetch/prefetch_params.cc).
Proposal:
- Add a pref, e.g.
dom.speculation_rules.fetch_timeout_ms, defaulting to 10000. - Arm a one-shot timer in
PrefetchRecordParent::StartFetch, and cancel it inOnStopRequest. - When it fires, call
PrefetchRecordParent::MarkCanceled(), which cancels the channel, fires the failure status event and callsWindowGlobalParent::PumpPrefetchQueue()so the next queued record starts. - A navigation that is waiting for the record (
dom.speculation_rules.wait_timeout_ms) then falls back to a normal load. - Test: a browser mochitest with a lowered timeout and a slow response, checking that the prefetch is canceled and that a queued prefetch starts in its place.
| Reporter | ||
Updated•10 days ago
|
Severity: -- → N/A
Priority: -- → P3
Whiteboard: [necko-triaged]
You need to log in
before you can comment on or make changes to this bug.
Description
•