Skip to content

fix(renderer): propagate termination through cross-origin window caches - #1586

Closed
lanyue-llk wants to merge 1 commit into
mainfrom
codex/webfetch-interruption
Closed

lanyue-llk wants to merge 1 commit into
mainfrom
codex/webfetch-interruption

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #1594, which removes the WeakMap cross-origin surface cache and includes the Location initialization failure follow-up. Further review continues there.

Problem

Cross-origin Window/Location cache lookup and construction used operations that could fail during V8 termination. Treating those failures as infallible could panic or retain a partially built surface.

Problem and solution for PR #1586

Change

Propagate missing cache/prototype values through the existing optional access surface. Stop construction on termination, leave the cache empty, and allow a later non-terminated access to recover. Keep ordinary cache failures visible.

This changes failure propagation only. It does not relax cross-origin access checks or alter the cancellation policy.

Reproduce and verify

The unit fixtures terminate execution before cache lookup and during surface creation. The builder must not run after termination; a failed construction must not be cached; recovery must succeed once termination is canceled. A separate control ensures ordinary cache errors are not silently discarded.

cargo nextest run --locked -p moli-renderer-v8 --lib -E 'test(cross_origin_cache::tests)' --no-fail-fast

Before extraction, this source passed cargo fmt --all, workspace/all-target/all-feature Clippy with -D warnings, and the full workspace nextest suite (20,140 passed, 17 skipped). This unit has no source changes since that validation. The PR CI checks its extraction onto main be610b8fe.

Regression fixtures:

Dependencies

Independent change targeting main; no other open PR is required. Extracted from #1501. Review map and sibling PRs.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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 Page.navigate commands per binary.

Common ancestor be610b8fe3 → HEAD 4a317e2e74; benchmark order: base-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 188 / 200 184 / 200
Failures / recovered 12 / 12 16 / 16
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 905.9 s 982.1 s

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

Metric Base HEAD Δ
Boundary samples 200 200 0
Boundary RSS samples 200 200 0
Boundary PSS samples 200 200 0
Periodic peak RSS 267.7 MiB 273.3 MiB +5.7 MiB
Periodic peak PSS 264.4 MiB 270.1 MiB +5.7 MiB
RSS · first 10 avg 179.5 MiB 177.5 MiB -2.1 MiB
RSS · last 10 avg 191.1 MiB 194.3 MiB +3.2 MiB
RSS · last − first window +11.6 MiB +16.8 MiB +5.3 MiB
RSS · warm slope / 100 nav +3.0 MiB +3.4 MiB +0.4 MiB
PSS · first 10 avg 176.6 MiB 174.5 MiB -2.1 MiB
PSS · last 10 avg 188.0 MiB 191.7 MiB +3.7 MiB
PSS · last − first window +11.5 MiB +17.3 MiB +5.8 MiB
PSS · warm slope / 100 nav +3.1 MiB +3.7 MiB +0.6 MiB
Peak file descriptors 65 64 -1
Peak threads 31 31 0

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 181.0 MiB 158.9 MiB 248.2 MiB 178.0 MiB 155.7 MiB 57
51–100 186.5 MiB 138.7 MiB 247.8 MiB 183.1 MiB 135.9 MiB 55
101–150 187.6 MiB 171.6 MiB 246.4 MiB 184.7 MiB 168.7 MiB 56
151–200 189.2 MiB 179.4 MiB 273.8 MiB 186.4 MiB 176.6 MiB 58

Raw reports and per-navigation boundary samples: workflow run and full sequential-navigation-soak-results artifact.

Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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 be610b8fe391 → HEAD 4a317e2e74ed; benchmark order: base-first; workflow: success.

Public 48-site run · informational

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 184 / 240 184 / 240 0 (0.00%)
Contract fill 76.67% 76.67% 0.00 pp (0.00%)
Sites with rows 38 / 48 38 / 48 0 (0.00%)
Sites meeting row contract 36 / 48 36 / 48 0 (0.00%)
Unexpected empty sites 10 10 0 (0.00%)
Partial-row sites 2 2 0 (0.00%)
Site outcomes extracted: 36; HTTP error + rows: 2; empty: 7; HTTP error + empty: 1; snapshot error + empty: 2 extracted: 37; HTTP error + rows: 1; empty: 7; HTTP error + empty: 1; snapshot error + empty: 2 —
Observed duration 61.78 s 54.85 s -6.93 s (-11.22%)
Estimated CPU 54.32 s 52.01 s -2.32 s (-4.27%)
Peak PSS 250.28 MiB 280.32 MiB +30.04 MiB (+12.00%)
Peak RSS 253.95 MiB 284.01 MiB +30.05 MiB (+11.83%)
Peak threads 27 26 -1 (-3.70%)
Mismatched sites 0 0 0
Timeout with items 0 0 0
Category rows Base HEAD Δ
news 35 / 40 35 / 40 0
stocks 20 / 40 20 / 40 0
tech 35 / 40 35 / 40 0
sports 27 / 40 27 / 40 0
games 37 / 40 37 / 40 0
life 30 / 40 30 / 40 0

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 timelines

These 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.

Base

xychart-beta
    title "Base CPU"
    x-axis "Elapsed seconds" [1.537, 3.039, 3.541, 5.044, 5.544, 7.047, 8.549, 10.55, 12.051, 14.054, 15.556, 17.058, 19.06, 20.561, 22.564, 24.067, 26.068, 27.571, 29.573, 31.076, 32.578, 34.581, 36.083, 36.584, 38.086, 39.587, 41.589, 43.093, 45.096, 46.597, 48.099, 50.103, 51.605, 53.609, 55.111, 57.113, 58.614, 60.616]
    y-axis "CPU percent" 0 --> 500
    line [53.98, 135.78, 131.65, 157.66, 207.9, 141.73, 167.91, 171.76, 177.81, 55.97, 45.95, 101.74, 19.99, 0, 75.95, 35.95, 7.98, 2, 2, 37.92, 91.93, 123.64, 119.86, 99.88, 129.8, 131.89, 103.85, 77.83, 83.9, 55.95, 111.87, 37.96, 133.76, 13.98, 15.98, 134.02, 39.94, 193.59]
Loading
xychart-beta
    title "Base memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.537, 3.039, 3.541, 5.044, 5.544, 7.047, 8.549, 10.55, 12.051, 14.054, 15.556, 17.058, 19.06, 20.561, 22.564, 24.067, 26.068, 27.571, 29.573, 31.076, 32.578, 34.581, 36.083, 36.584, 38.086, 39.587, 41.589, 43.093, 45.096, 46.597, 48.099, 50.103, 51.605, 53.609, 55.111, 57.113, 58.614, 60.616, 61.781]
    y-axis "Memory MiB" 0 --> 500
    line [12.34, 102.49, 134.62, 114.42, 168.8, 161.45, 236.5, 221.53, 163.08, 187.95, 160.52, 168.68, 185.46, 148.08, 147.97, 171.08, 144.24, 148, 146.84, 146.86, 154.25, 183.62, 182.47, 194.27, 253.95, 205.61, 234.98, 149.09, 189.07, 158, 159.48, 165.81, 160.93, 220.81, 177.72, 162.63, 182.15, 171.65, 209.61, 0]
    line [9.06, 98.81, 131.11, 110.83, 165.17, 157.88, 233.04, 217.92, 159.38, 184.26, 156.82, 164.98, 181.79, 144.37, 144.26, 167.37, 140.53, 144.29, 143.13, 143.15, 150.21, 179.91, 178.25, 190.6, 250.28, 202.06, 231.16, 145.32, 185.36, 154.3, 155.77, 162.09, 157.22, 217.12, 174.01, 158.92, 178.58, 167.94, 206.16, 0]
Loading

HEAD

xychart-beta
    title "HEAD CPU"
    x-axis "Elapsed seconds" [1.036, 1.536, 3.037, 4.538, 6.039, 7.539, 9.04, 10.542, 12.044, 14.047, 15.549, 17.052, 18.555, 20.058, 21.561, 23.063, 24.566, 26.067, 27.569, 29.071, 30.573, 32.074, 32.575, 33.576, 35.078, 36.58, 38.081, 39.584, 40.085, 41.588, 43.089, 44.591, 46.094, 47.596, 49.098, 50.6, 52.101, 53.602]
    y-axis "CPU percent" 0 --> 500
    line [0, 2, 2, 121.95, 112.03, 155.69, 131.89, 163.83, 181.77, 85.91, 157.83, 89.8, 5.99, 89.74, 65.8, 65.92, 4, 0, 45.95, 83.86, 127.87, 115.81, 101.95, 137.81, 129.96, 143.9, 143.78, 127.73, 193.68, 111.85, 11.98, 85.88, 103.78, 4, 117.83, 129.83, 131.95, 129.88]
Loading
xychart-beta
    title "HEAD memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.036, 1.536, 3.037, 4.538, 6.039, 7.539, 9.04, 10.542, 12.044, 14.047, 15.549, 17.052, 18.555, 20.058, 21.561, 23.063, 24.566, 26.067, 27.569, 29.071, 30.573, 32.074, 32.575, 33.576, 35.078, 36.58, 38.081, 39.584, 40.085, 41.588, 43.089, 44.591, 46.094, 47.596, 49.098, 50.6, 52.101, 53.602, 54.848]
    y-axis "Memory MiB" 0 --> 500
    line [12.16, 54.75, 54.69, 62.3, 119.7, 145.27, 155.26, 170.24, 175.61, 179.39, 181.04, 153.45, 161.91, 145.58, 160.52, 151.09, 152.56, 147.9, 147.54, 152.29, 178.1, 174.96, 220.64, 284.01, 203.82, 220.91, 189.32, 162.29, 196.93, 173.71, 171.2, 157.84, 187.43, 185.38, 183.08, 181.07, 200.59, 157.71, 192.92, 0]
    line [9.02, 51.21, 51.15, 58.75, 116.44, 141.7, 151.69, 166.63, 171.99, 175.46, 177.43, 150.15, 158.25, 141.92, 157.18, 146.57, 148.9, 144.24, 143.88, 148.71, 174.44, 171.38, 217.04, 280.32, 200.15, 217.29, 185.81, 158.63, 193.32, 170.19, 167.57, 154.17, 184.51, 181.8, 179.42, 177.27, 196.98, 154.05, 189.31, 0]
Loading

Deterministic fixture · required contract

The fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 40 / 40 40 / 40 0 (0.00%)
Contract fill 100.00% 100.00% 0.00 pp (0.00%)
Sites with rows 8 / 15 8 / 15 0 (0.00%)
Sites meeting row contract 15 / 15 15 / 15 0 (0.00%)
Unexpected empty sites 0 0 0
Partial-row sites 0 0 0
Site outcomes extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 —
Observed duration 19.86 s 19.86 s -0.01 s (-0.03%)
Estimated CPU 0.41 s 0.43 s +0.02 s (+4.85%)
Peak PSS 66.75 MiB 66.78 MiB +0.02 MiB (+0.04%)
Peak RSS 70.43 MiB 70.44 MiB +0.02 MiB (+0.02%)
Peak threads 18 18 0 (0.00%)
Mismatched sites 0 0 0
Timeout with items 0 0 0

Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full spider-bench-results artifact.

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.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

CI Regression Report

Source CI run · source state at render: in_progress · artifacts: 6/6

Check Status Signal
Release regression ✅ HEAD/base failures 0/0; raw binary 0.00%
Frontend differential ✅ 1,020/1,020 cases matched; 0 issues; 1 Chromium reference recoveries
Agent episodes ✅ 8/8 Moli episodes passed; 0 failures
Runtime/CDP contracts ✅ 26 contract cases; 0 failures
CDP smoke ✅ 52/52 groups passed; 621 scenarios
WebMainBench ✅ 545/545 completed; 0 unexpected failures
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%

Package and image size

Metric Base HEAD Delta Delta %
Raw binary 153.02 MiB 153.02 MiB 0 B 0.00%
Stripped binary 106.34 MiB 106.34 MiB 0 B 0.00%
gzip binary 52.70 MiB 52.70 MiB +417 B +0.000755%
Rootfs 159.92 MiB 159.92 MiB 0 B 0.00%
gzip rootfs 61.74 MiB 61.74 MiB +60 B +0.000093%

Startup latency and PSS

Case Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta
Serve ready 27.40 ms 27.23 ms −0.18 ms 4.89 MiB 4.11 MiB −798.50 KiB
CDP first page 50.73 ms 49.86 ms −0.87 ms 4.49 MiB 3.54 MiB −971.00 KiB
CDP warm page 12.58 ms 11.44 ms −1.14 ms 50.08 MiB 49.83 MiB −256.00 KiB
CLI about:blank 15.36 ms 15.26 ms −0.10 ms 4.18 MiB 2.48 MiB −1.70 MiB
CLI local JS 18.43 ms 22.94 ms +4.51 ms 1.83 MiB 3.54 MiB +1.72 MiB

Concurrency matrix

Concurrency Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta HEAD failures Unstable B/H
1 25.24 ms 23.90 ms −1.34 ms 453.00 KiB 453.00 KiB 0 B 0 0/0
5 36.65 ms 37.86 ms +1.21 ms 7.50 MiB 6.96 MiB −561.00 KiB 0 0/0
10 34.86 ms 38.71 ms +3.85 ms 8.44 MiB 4.34 MiB −4.10 MiB 0 0/0
25 34.85 ms 38.95 ms +4.10 ms 7.24 MiB 4.28 MiB −2.96 MiB 0 0/0
100 37.80 ms 36.31 ms −1.49 ms 5.79 MiB 6.33 MiB +549.00 KiB 0 0/0
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues; 1 Chromium reference recoveries
Match DOM mismatch Diagnostic mismatch Moli error Reference error Infrastructure error Mismatched frames Duration
1,020 0 0 0 0 0 0 7m 35.38s

Recovered Chromium reference infrastructure failures

  • react/gallery-workspaces/design-token-manager — 1 failed attempt(s) before recovery · unknown
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Fast contract Episodes Passed Assertions Ready p50 Episode p50
Moli 8 8 47/47 3.70 ms 25.39 ms
Chromium 8 8 47/47 259.99 ms 91.01 ms
Operation p50 Chromium Moli Delta Delta %
navigate 44.59 ms 5.93 ms −38.66 ms −86.71%
observe 0.95 ms 0.91 ms −0.04 ms −3.86%
fill 4.10 ms 3.54 ms −0.56 ms −13.64%
click 5.62 ms 4.05 ms −1.58 ms −28.03%
Idle-resource episode Peak RSS Peak PSS Average CPU Peak CPU Peak processes Sampler
Moli 66.44 MiB 63.82 MiB 0.74% 11.96% 1 ✅
Chromium 1287.81 MiB 304.00 MiB 1.93% 95.82% 13 ⚠️ PSS partial
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
Suite Cases Failures Median case p50 Median case p95 Median peak PSS p50
Synthetic fetch 13 0 18.90 ms 20.06 ms 903.00 KiB
Long-lived CDP session 13 0 18.52 ms 19.27 ms —
CDP smoke — ✅ 52/52 groups passed; 621 scenarios

Workers: 4 · cumulative group time: 192.77 s · failed groups: 0

Slowest group Scenarios Duration Status
scrollbar-visibility 22 29.61 s ✅
target-lifecycle 24 16.33 s ✅
dom-input 27 12.72 s ✅
chromium-cdp 56 11.24 s ✅
multi-page 45 11.07 s ✅
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Completed Successful Expected DNS failure Unexpected failures Panics Crashes Timeouts Empty output
545/545 544 1 0 0 0 0 0

Frozen HTML · Linux · --wait done · 45 seconds per page · no retries. Content quality is evaluated separately.

Diagnostics: webmainbench-results — every page's Markdown, stderr, and exit status. Source run and artifacts

All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable.

@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-interruption branch from 5a09e3c to 4a317e2 Compare October 15, 2026 13:35

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复核提交 4a317e2e74ed,未发现本次改动新增的明确阻断问题。

WeakMap 的构造和 get/set 都可能执行 V8 操作,终止时将空结果直接 expect 确实会把正常取消变成进程故障。这里用 TryCatch 保留终止原因、沿既有 Option 返回路径退出,同时保留非终止内部错误的失败行为,修改范围合适。缓存仍按目标窗口和访问方 realm 区分;此次修改没有绕过跨域权限判断,也没有把失败构造的结果写入缓存。

已追踪缓存初始化、窗口/Location 访问方和新增测试;本机缺少原生开发工具,未运行该提交的 V8 测试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants