Repository navigation
fix(page): unify document load-delay invalidation - #2802
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review of 58037d4
No blocking findings
- Root cause: fixed.
stop_loading_without_load_event(frame_owner_model/records.rs:867-883) clears every blocker and setsload = Suppressedon a Document that stays current. For a main Document, only this path setsSuppressed;records.rs:918is limited to child documents, andmain_document_task_owner_is_currentexcludes those. Soload_was_stopped()used instore.rs:2809-2816means "Page.stopLoading cleared this token". Any other failed release on a non-stopped Document still reaches the assert atstylesheet_page_tasks.rs:116, so this is narrower than deleting the assert. After the stop,acquire_load_delayrejects aCompletedocument, andaccept_current_main_style_load_event(store.rs:2757-2781) creates token-less bindings, which settle astrue. A stale token from before the stop is the only case the new branch handles. - All three paths in the issue are covered. On v1.1.23, the
/htmllink(streaming HTML with a slow<link>) and/xmlpart(streamingapplication/xmlwith the injected viewer<style>) repros each abort at the samestylesheet_page_tasks.rs:117:9, just like/htmldone_link. All three go throughsettle_main_style_load_event, which this change handles. Only/htmldone_linkwas verified at runtime with the PR build; the other two are covered by code reading. - Load event: after the stop,
begin_main_load_dispatchrequiresReady, soSuppressedblocks it; the new test checks this. A later navigation creates a new Document record withPendingload. A style task left over from the stopped Document failsmain_style_load_event_is_currentand takes theExactBindingRetiredWithDocumentpath, so it does not reach the new branch. - Other settle paths a stop can reach: image, media, stylesheet-subresource and async/deferred script releases have no release-mode
assert!/expecton the result. The remaining checks (document_scripts.rs:190,288,document_write.rs:2010) aredebug_assert!s on synchronous acquire→reject sequences, so a stop cannot interleave with them. - Test: it reproduces the exact sequence (task taken, stop, task applied) and asserts that no window
loadfires. The negative control described in the body is plausible. - Cost: the extra lookup runs only on the path that used to panic, so the numbers are plausible.
- Body: picture pending. CI: Nextest, CDP smoke and both Build release jobs are still queued; the completed checks pass.
Non-blocking, not caused by this PR: the issue's Chromium expectation also says the stylesheet request ends with Network.loadingFailed net::ERR_ABORTED. Page.stopLoading does not cancel subresource fetches today, so after this fix the stylesheet still arrives and is applied. That gap predates this PR and is not needed to fix the crash, but closing #2796 leaves that part of its Expected section unaddressed. Consider leaving a follow-up note.
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 118/118 groups passed; 1,784 scenariosWorkers: 4 · cumulative group time: 447.87 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |
Spider Bench A/B✅ All benchmark browser service runs completed; results are informational. Public HEAD: 184 / 240 rows; 38 / 48 sites produced rows; 10 unexpected empty sites. ✅ Deterministic fixture contract is clean. Common ancestor Public 48-site run · informational
Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression. CPU and memory timelinesThese are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available. Basexychart-beta
title "Base CPU"
x-axis "Elapsed seconds" [1.545, 2.547, 3.048, 4.049, 5.052, 5.553, 7.054, 8.555, 9.557, 11.058, 12.559, 14.061, 15.062, 16.566, 18.069, 19.572, 20.573, 22.076, 23.578, 25.08, 26.085, 27.587, 29.089, 30.591, 31.592, 33.094, 34.596, 36.099, 37.1, 38.603, 40.105, 41.605, 42.606, 44.109, 45.611, 46.112, 47.113, 48.114]
y-axis "CPU percent" 0 --> 200
line [103.92, 111.68, 111.89, 107.76, 125.71, 141.88, 91.81, 122.08, 59.8, 139.86, 141.7, 135.99, 115.71, 37.91, 79.88, 135.84, 103.8, 111.79, 135.69, 137.84, 69.45, 95.86, 103.9, 77.95, 143.88, 101.89, 49.96, 71.85, 0, 27.98, 0, 31.98, 65.84, 15.97, 103.85, 153.73, 47.93, 135.67]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.044, 1.545, 2.547, 3.048, 4.049, 5.052, 5.553, 7.054, 8.555, 9.557, 11.058, 12.559, 14.061, 15.062, 16.566, 18.069, 19.572, 20.573, 22.076, 23.578, 25.08, 26.085, 27.587, 29.089, 30.591, 31.592, 33.094, 34.596, 36.099, 37.1, 38.603, 40.105, 41.605, 42.606, 44.109, 45.611, 46.112, 47.113, 48.114, 49.275]
y-axis "Memory MiB" 0 --> 500
line [13.88, 96.63, 114.96, 127.5, 127.77, 155.43, 130.95, 151.57, 168.51, 138.25, 142.92, 144.05, 140.02, 119.72, 131.24, 138.95, 149.57, 271.34, 186.66, 167.85, 175.46, 148.21, 156.26, 142.32, 150.41, 186.34, 235.55, 223.91, 234.94, 231.43, 232.57, 231.73, 229.02, 258.37, 136.17, 168.64, 151.86, 136.95, 165.3, 0]
line [10, 92.54, 111.02, 123.58, 123.74, 151.37, 126.99, 147.48, 164.48, 134.12, 138.75, 139.48, 135.05, 115.51, 127.07, 134.54, 145.51, 267.22, 182.54, 163.77, 171.5, 143.95, 152.01, 138.19, 144.34, 182.07, 231.84, 219.68, 230.71, 227.22, 228.59, 227.79, 225.1, 254.6, 132.42, 165.08, 148.18, 133.56, 161.72, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [2.058, 3.56, 4.061, 5.063, 6.064, 8.067, 10.07, 12.072, 14.075, 16.078, 18.082, 20.085, 22.087, 24.089, 26.09, 28.092, 30.095, 32.098, 33.6, 34.101, 36.104, 38.108, 40.111, 42.112, 44.114, 46.116, 48.118, 50.12, 52.123, 54.125, 56.128, 58.132, 60.137, 62.14, 64.143, 66.145, 68.147, 70.15]
y-axis "CPU percent" 0 --> 200
line [115.78, 133.74, 83.84, 151.63, 133.93, 141.68, 131.91, 133.91, 99.76, 87.96, 99.88, 101.93, 105.99, 119.8, 127.87, 107.85, 89.88, 43.93, 113.78, 103.85, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 1.99, 0, 9.99, 101.9, 109.87, 101.88]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.056, 2.058, 3.56, 4.061, 5.063, 6.064, 8.067, 10.07, 12.072, 14.075, 16.078, 18.082, 20.085, 22.087, 24.089, 26.09, 28.092, 30.095, 32.098, 33.6, 34.101, 36.104, 38.108, 40.111, 42.112, 44.114, 46.116, 48.118, 50.12, 52.123, 54.125, 56.128, 58.132, 60.137, 62.14, 64.143, 66.145, 68.147, 70.15, 71.909]
y-axis "Memory MiB" 0 --> 500
line [13.91, 99.9, 117.61, 118.73, 144.2, 145.61, 138.05, 143.04, 134.24, 128.22, 122.67, 154.3, 148.84, 246.77, 129.18, 143.04, 137.53, 130.2, 137.77, 246.91, 244.66, 223.89, 231.21, 232.22, 230.93, 230.95, 230.91, 230.95, 230.94, 230.97, 230.36, 229.84, 229.86, 229.82, 229.82, 143.82, 160.89, 166.58, 150.38, 0]
line [10.51, 96.26, 112.96, 114.97, 140.61, 141.95, 134.52, 139.39, 130.9, 124.39, 118.94, 150.57, 145.06, 242.43, 125.73, 139.68, 133.79, 126.48, 134.05, 243.12, 240.91, 220.12, 227.56, 228.57, 226.66, 226.68, 226.65, 226.69, 226.68, 226.72, 226.11, 225.59, 225.62, 225.56, 225.57, 139.56, 156.63, 162.37, 146.07, 0]
Deterministic fixture · required contractThe fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.
Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking. |
Sequential Navigation Soak A/B✅ HEAD completed the 200-navigation resilience and memory observation. One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Common ancestor Session resilience
A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence. Process-tree memory
HEAD memory by 50-navigation quarter
Raw reports and per-navigation boundary samples: workflow run and full Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold. |
006072b to
9385d1c
Compare
Page.stopLoadingends loading without replacing the current Document. Resource tasks queued before stop now settle their exact load-delay bindings asInvalidated, without asserting or reporting a fresh release.The Document-owned blocker ledger has a shared
Open → Invalidated → Retiredlifetime across resource types. Invalidation removes blocking authority while retaining outstanding token/reason identities for idempotent late cleanup. Unknown tokens, mismatched reasons and tokens released before invalidation remain rejected; retirement clears the retained identities. Parser/DCL and Window load still have separate blocking rules.Stylesheet, image, media and script completions use these shared settlement rules. Callers distinguish an actual release from an invalidated binding, and connected-style tasks report that distinction explicitly. The stylesheet-specific check for a suppressed Document load is removed.
Regression coverage includes all nine delay reasons, repeated invalidation and cleanup, forced initial-empty completion, Document retirement/replacement, and a real VM test asserting one
style.onloadand nowindow.onloadafter stop. Supplemental mutation checks against the core modules fail if invalidation erases token identities or settlement stops checking the reason.Validation from the repository root:
cargo fmt --allcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run --no-fail-fast— 23,158 passed, 20 skipped.Network request cancellation, including preventing late CSS responses from applying after stop, remains tracked in #2765.
Closes #2796.
Replaces part of #759.