Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8abad55818 | ||
|
|
d5a8f59b64 | ||
|
|
1b64faf5cf |
No files matched your search
@@ -0,0 +1,111 @@
|
||||
name: webgl-module-hunt (the module of the WebGL determinism test, repeated)
|
||||
|
||||
# A hunt, not a gate. test_webgl_getParameter_deterministic gave `getContext('webgl') == null` once in a run of the whole suite on a loaded runner and never alone
|
||||
# (about 1500 isolated runs here and on GitHub). In the suite the module tests/test_fingerprint_consistency.py runs whole on ONE xdist worker, in file order, on a
|
||||
# browser the module shares (about 50 tests before the WebGL one). So this repeats THAT: the whole module, in order, in PROCS processes at once, ROUNDS times each,
|
||||
# beside other WebGL/canvas modules running in the same job (the load the suite puts on the machine). Every round that fails, or says 'gl null', keeps its log and
|
||||
# the engine's own log of the WebGL/GL channels; the reason the browser gives (webglcontextcreationerror.statusMessage, now in the assertion) is collected.
|
||||
# It starts on a push that touches this file.
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/webgl-module-hunt.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rounds:
|
||||
description: 'rounds per process'
|
||||
required: false
|
||||
default: '20'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
PROCS: '4'
|
||||
NOISE: '2'
|
||||
ROUNDS: ${{ inputs.rounds || '20' }}
|
||||
|
||||
jobs:
|
||||
hunt:
|
||||
name: webgl module x${{ inputs.rounds || '20' }} in 4 processes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Install the wrapper + test deps
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ".[dev]"
|
||||
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
|
||||
- name: System deps (xvfb + Firefox runtime libs)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb
|
||||
sudo "$(which python)" -m playwright install-deps firefox
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
- name: The module, repeated in PROCS processes beside the noise
|
||||
env:
|
||||
PYTHONUNBUFFERED: '1'
|
||||
run: |
|
||||
mkdir -p evidence
|
||||
export INVPW_BINARY_PATH="$FF" STEALTHFOX_E2E_BINARY="$FF" MOZ_CRASHREPORTER_DISABLE=1
|
||||
# the noise: other WebGL / canvas modules, in a loop, in NOISE processes, until the hunt is done
|
||||
rm -f evidence/stop
|
||||
for n in $(seq 1 "$NOISE"); do
|
||||
(
|
||||
while [ ! -e evidence/stop ]; do
|
||||
for f in tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py tests/test_webgl_blending_rounds_once_e2e.py \
|
||||
tests/test_webgl_mediump_is_full_precision_e2e.py tests/test_canvas_render_stealth.py; do
|
||||
[ -e evidence/stop ] && break
|
||||
xvfb-run -a python -m pytest "$f" -m e2e -q -p no:cacheprovider > /dev/null 2>&1 || true
|
||||
done
|
||||
done
|
||||
) &
|
||||
done
|
||||
for p in $(seq 1 "$PROCS"); do
|
||||
(
|
||||
for r in $(seq 1 "$ROUNDS"); do
|
||||
base="evidence/module_r$(printf %02d "$r")_p${p}"
|
||||
MOZ_LOG="WebGL:5,GLContext:5,gfx:4,sync" MOZ_LOG_FILE="${base}.moz" \
|
||||
xvfb-run -a python -m pytest tests/test_fingerprint_consistency.py -m e2e -q -p no:cacheprovider -rA > "${base}.log" 2>&1
|
||||
code=$?
|
||||
echo "round $r proc $p exit $code" >> evidence/rounds.txt
|
||||
if [ "$code" = 0 ] && ! grep -aq "gl null" "${base}.log"; then
|
||||
rm -f "${base}.log" "${base}".moz*
|
||||
fi
|
||||
done
|
||||
) &
|
||||
done
|
||||
# wait for the PROCS repeaters only (the noise loops run until the stop file)
|
||||
while [ "$(grep -c . evidence/rounds.txt 2>/dev/null || echo 0)" -lt $((PROCS * ROUNDS)) ]; do sleep 5; done
|
||||
touch evidence/stop
|
||||
wait || true
|
||||
- name: What was seen
|
||||
if: always()
|
||||
run: |
|
||||
total=$(grep -c . evidence/rounds.txt || true)
|
||||
bad=$(grep -vc "exit 0" evidence/rounds.txt || true)
|
||||
echo "rounds: ${total}, not green: ${bad}"
|
||||
grep -v "exit 0" evidence/rounds.txt || true
|
||||
echo "--- reasons the browser gave (webglcontextcreationerror.statusMessage) ---"
|
||||
grep -ah "errors=\|WebGL creation failed\|gl null\|FEATURE_FAILURE" evidence/*.log 2>/dev/null | sort | uniq -c | sort -rn | head -20 || true
|
||||
echo "--- tests that failed ---"
|
||||
grep -ah "^FAILED" evidence/*.log 2>/dev/null | sort | uniq -c | sort -rn | head -10 || true
|
||||
- name: Upload the evidence (failed rounds only, and the round list)
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: webgl-module-hunt-${{ github.run_id }}
|
||||
path: evidence
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -0,0 +1,98 @@
|
||||
name: "webgl-stock-vs-ours-hunt (the first WebGL context, our engine against Playwright Firefox and the official release)"
|
||||
|
||||
# A hunt, not a gate. The rate at which the FIRST WebGL context of a fresh browser comes back null on a loaded runner, for our engine and for Playwright's own
|
||||
# Firefox and for the OFFICIAL Firefox 159 release (Selenium + geckodriver), in the same job, on the same Xvfb, alternating round by round: ours (headless=True, our
|
||||
# Xvfb path), Playwright's Firefox headed under the job's Xvfb, Playwright's Firefox with its own headless, the official release headed under the Xvfb. Each round is a fresh browser, 38 cheap evaluations, then getContext('webgl') and ('webgl2') with the browser's reason (webglcontextcreationerror).
|
||||
# PROCS processes at once beside NOISE loops of other WebGL/canvas modules. It starts on a push that touches .hunt/webgl-stock.trigger (NOT on a push of this
|
||||
# file): the maintainer decides when the runners are free.
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.hunt/webgl-stock.trigger'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
PROCS: '4'
|
||||
NOISE: '2'
|
||||
ROUNDS: '40'
|
||||
|
||||
jobs:
|
||||
hunt:
|
||||
name: first webgl context, ours vs stock vs retail, 4 processes x 40 rounds x 4 modes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Install the wrapper + test deps, and Playwright's own Firefox as the control
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ".[dev]"
|
||||
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)" selenium
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb
|
||||
sudo "$(which python)" -m playwright install-deps firefox
|
||||
python -m playwright install firefox
|
||||
- name: The official Firefox 159 release (tarball checked against the published sums)
|
||||
run: |
|
||||
base=https://archive.mozilla.org/pub/firefox/releases/159.0
|
||||
mkdir -p retail && cd retail
|
||||
curl -fsSL -O "$base/linux-x86_64/en-US/firefox-159.0.tar.xz"
|
||||
curl -fsSL -O "$base/SHA512SUMS"
|
||||
grep " linux-x86_64/en-US/firefox-159.0.tar.xz\$" SHA512SUMS | sed 's# linux-x86_64/en-US/# #' | sha512sum -c -
|
||||
tar xJf firefox-159.0.tar.xz
|
||||
echo "RETAIL_FIREFOX=$PWD/firefox/firefox" >> "$GITHUB_ENV"
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
- name: Alternate, in PROCS processes, beside the noise
|
||||
env:
|
||||
PYTHONUNBUFFERED: '1'
|
||||
run: |
|
||||
mkdir -p evidence
|
||||
export INVPW_BINARY_PATH="$FF" STEALTHFOX_E2E_BINARY="$FF" MOZ_CRASHREPORTER_DISABLE=1
|
||||
rm -f evidence/stop evidence/done.txt
|
||||
for n in $(seq 1 "$NOISE"); do
|
||||
(
|
||||
while [ ! -e evidence/stop ]; do
|
||||
for f in tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py tests/test_webgl_blending_rounds_once_e2e.py \
|
||||
tests/test_webgl_mediump_is_full_precision_e2e.py tests/test_canvas_render_stealth.py; do
|
||||
[ -e evidence/stop ] && break
|
||||
xvfb-run -a python -m pytest "$f" -m e2e -q -p no:cacheprovider > /dev/null 2>&1 || true
|
||||
done
|
||||
done
|
||||
) &
|
||||
done
|
||||
for p in $(seq 1 "$PROCS"); do
|
||||
(
|
||||
for r in $(seq 1 "$ROUNDS"); do
|
||||
for mode in ours stock-headed stock-headless retail-headed; do
|
||||
xvfb-run -a python scripts/webgl_first_context_probe.py "$mode" "evidence/rows_p${p}.jsonl" 38 > /dev/null 2>&1 || true
|
||||
done
|
||||
done
|
||||
echo "p${p}" >> evidence/done.txt
|
||||
) &
|
||||
done
|
||||
while [ "$(grep -c . evidence/done.txt 2>/dev/null || echo 0)" -lt "$PROCS" ]; do sleep 5; done
|
||||
touch evidence/stop
|
||||
wait || true
|
||||
- name: What was seen
|
||||
if: always()
|
||||
run: python scripts/webgl_probe_tally.py evidence
|
||||
- name: Upload the rows
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: webgl-stock-vs-ours-${{ github.run_id }}
|
||||
path: evidence
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -0,0 +1,71 @@
|
||||
"""The first WebGL context of a fresh browser, ours or Playwright's own Firefox, in the same job: null or not, and the browser's own reason.
|
||||
|
||||
python scripts/webgl_first_context_probe.py MODE OUT.jsonl [WARM]
|
||||
|
||||
MODE: ours (InvisiblePlaywright, headless=True: our Xvfb path, seed 42, as tests/test_fingerprint_consistency.py) | stock-headed | stock-headless
|
||||
(Playwright's own Firefox, launched headed under the job's Xvfb, or with its own headless) | retail-headed (the official Firefox release, path in RETAIL_FIREFOX,
|
||||
driven by Selenium and geckodriver, headed under the job's Xvfb: the browser a user has). WARM: how many cheap evaluations come first on the
|
||||
page (the module ran 38 tests on the browser before the WebGL one). One JSON line is appended: mode, webgl/webgl2 null or not, the statusMessages,
|
||||
the version of the browser, the milliseconds the whole round took.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
mode, out = sys.argv[1], sys.argv[2]
|
||||
warm = int(sys.argv[3]) if len(sys.argv) > 3 else 38
|
||||
|
||||
JS = """() => {
|
||||
const errors = [];
|
||||
const c = document.createElement('canvas');
|
||||
c.addEventListener('webglcontextcreationerror', e => errors.push(e.statusMessage || ''), false);
|
||||
const gl = c.getContext('webgl');
|
||||
const c2 = document.createElement('canvas');
|
||||
c2.addEventListener('webglcontextcreationerror', e => errors.push('webgl2: ' + (e.statusMessage || '')), false);
|
||||
const gl2 = c2.getContext('webgl2');
|
||||
return {webgl: !!gl, webgl2: !!gl2, errors, lost: gl ? gl.isContextLost() : null};
|
||||
}"""
|
||||
WARM_JS = "() => [navigator.userAgent, Math.cos(1e308), Math.sin(Math.PI), screen.width, performance.now()].length"
|
||||
|
||||
row = {"mode": mode, "warm": warm}
|
||||
t0 = time.monotonic()
|
||||
try:
|
||||
if mode == "ours":
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
with InvisiblePlaywright(seed=42, binary_path=os.environ["INVPW_BINARY_PATH"], headless=True) as browser:
|
||||
page = browser.new_context().new_page()
|
||||
page.goto("about:blank", timeout=30000)
|
||||
for _ in range(warm):
|
||||
page.evaluate(WARM_JS)
|
||||
row.update(page.evaluate(JS))
|
||||
elif mode == "retail-headed":
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
options = Options()
|
||||
options.binary_location = os.environ["RETAIL_FIREFOX"]
|
||||
driver = webdriver.Firefox(options=options)
|
||||
try:
|
||||
row["browser_version"] = driver.capabilities.get("browserVersion", "")
|
||||
driver.get("about:blank")
|
||||
for _ in range(warm):
|
||||
driver.execute_script("return (" + WARM_JS + ")()")
|
||||
row.update(driver.execute_script("return (" + JS + ")()"))
|
||||
finally:
|
||||
driver.quit()
|
||||
else:
|
||||
from playwright.sync_api import sync_playwright
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch(headless=(mode == "stock-headless"))
|
||||
row["browser_version"] = browser.version
|
||||
page = browser.new_context().new_page()
|
||||
page.goto("about:blank", timeout=30000)
|
||||
for _ in range(warm):
|
||||
page.evaluate(WARM_JS)
|
||||
row.update(page.evaluate(JS))
|
||||
browser.close()
|
||||
except Exception as e: # a launch that failed is a different finding: recorded, not counted as a null
|
||||
row["exception"] = str(e).splitlines()[0][:200]
|
||||
row["ms"] = round((time.monotonic() - t0) * 1000)
|
||||
with open(out, "a", encoding="utf-8") as f:
|
||||
f.write(json.dumps(row) + "\n")
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Tally of the rows webgl_first_context_probe.py wrote: per mode, the rounds, the nulls, the failed launches and the browser's reasons."""
|
||||
import collections
|
||||
import glob
|
||||
import json
|
||||
import sys
|
||||
|
||||
folder = sys.argv[1] if len(sys.argv) > 1 else "evidence"
|
||||
rows = []
|
||||
for f in glob.glob(folder + "/rows_p*.jsonl"):
|
||||
for line in open(f, encoding="utf-8"):
|
||||
try:
|
||||
rows.append(json.loads(line))
|
||||
except ValueError:
|
||||
pass
|
||||
by = collections.defaultdict(collections.Counter)
|
||||
reasons = collections.defaultdict(collections.Counter)
|
||||
versions = {}
|
||||
for r in rows:
|
||||
m = r["mode"]
|
||||
if "exception" in r:
|
||||
by[m]["launch failed"] += 1
|
||||
continue
|
||||
by[m]["rounds"] += 1
|
||||
by[m]["webgl null"] += (not r["webgl"])
|
||||
by[m]["webgl2 null"] += (not r["webgl2"])
|
||||
for e in r.get("errors", []):
|
||||
reasons[m][e[:160]] += 1
|
||||
if r.get("browser_version"):
|
||||
versions[m] = r["browser_version"]
|
||||
print("%-14s %8s %10s %11s %13s browser" % ("mode", "rounds", "webgl null", "webgl2 null", "launch failed"))
|
||||
for m in ("ours", "stock-headed", "stock-headless", "retail-headed"):
|
||||
c = by[m]
|
||||
print("%-14s %8d %10d %11d %13d %s" % (m, c["rounds"], c["webgl null"], c["webgl2 null"], c["launch failed"], versions.get(m, "")))
|
||||
for m, c in reasons.items():
|
||||
for e, n in c.most_common(5):
|
||||
print("reason (%s) x%d: %s" % (m, n, e))
|
||||
@@ -354,10 +354,17 @@ def test_webgl_getParameter_deterministic(page):
|
||||
res = _ev(page, """() => {
|
||||
const norm = v => (ArrayBuffer.isView(v) ? Array.from(v) : v);
|
||||
const c = document.createElement('canvas');
|
||||
// The browser's own reason for a context it could not create (the event carries it; the page only
|
||||
// sees null otherwise). A null seen once in 31 runs of the e2e on a loaded runner said 'gl null' and
|
||||
// nothing else, which cannot be told from a missing GL, a refused library, an allocation that failed.
|
||||
const errors = [];
|
||||
c.addEventListener('webglcontextcreationerror', e => errors.push(e.statusMessage || ''), false);
|
||||
const gl = c.getContext('webgl');
|
||||
if (!gl) {
|
||||
return {ok: false, reason: 'gl null',
|
||||
webgl2: !!c.getContext('webgl2')};
|
||||
const c2 = document.createElement('canvas');
|
||||
c2.addEventListener('webglcontextcreationerror', e => errors.push('webgl2: ' + (e.statusMessage || '')), false);
|
||||
return {ok: false, reason: 'gl null', errors,
|
||||
webgl2: !!c2.getContext('webgl2')};
|
||||
}
|
||||
if (gl.isContextLost()) {
|
||||
return {ok: false, reason: 'context lost'};
|
||||
@@ -385,7 +392,7 @@ def test_webgl_getParameter_deterministic(page):
|
||||
}""")
|
||||
assert res["ok"], (
|
||||
f"WebGL getParameter check failed: reason={res.get('reason')!r} "
|
||||
f"webgl2={res.get('webgl2')!r} round={res.get('round')!r} "
|
||||
f"webgl2={res.get('webgl2')!r} errors={res.get('errors')!r} round={res.get('round')!r} "
|
||||
f"param={res.get('param')!r} first={res.get('first')!r} "
|
||||
f"ref={res.get('ref')!r}"
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user