Compare commits

...
Author SHA1 Message Date
feder-cr db16831679 hunt: round 3, the same evidence (round 2, run 46190876308: no worker died in 45 rows, no dump; the controllers were born with error mode 0x0003, the workers with 0x0001) 2026-11-28 23:27:38 +01:00
feder-cr 0be56b5a1d hunt: round 2, every pytest process clears SEM_NOGPFAULTERRORBOX and writes the error mode it was born with 2026-11-28 21:18:36 +01:00
feder-cr cb87046cba hunt: round 2 clears SEM_NOGPFAULTERRORBOX in every pytest process and runs the loop to its end 2026-11-28 21:18:16 +01:00
feder-cr b1cbffcdda hunt: the P4 worker dump, the real Windows part 3 row in a loop until a WER dump of python.exe (temporary)
Eight Windows jobs, each with the setup of the e2e part 3 job (screen, WER LocalDumps of python.exe, deps, engine, GeoIP), loop the real row
wrapper.e2e.suite.windows.3 through scripts/run_e2e.py for 70 minutes, stop at the first .dmp, and report iterations, worker deaths and the
faulting module of each dump. Push-only on hunt/p4-worker-dump; green whatever happens.
2026-11-28 19:48:34 +01:00
2 changed files with 260 additions and 0 deletions

No files matched your search

+247
View File
@@ -0,0 +1,247 @@
# -----------------------------------------------------------------------------
# hunt-p4-worker-dump.yml - TEMPORARY. Deleted, with its branch, when the question is answered. Never merged to main.
#
# The question. On the Windows e2e part 3 row the pytest-xdist worker (python.exe) died with "Windows fatal exception: access violation" ("node down: Not properly terminated")
# while running tests/test_fakeweb_p4_e2e.py::test_the_journey_leaves_every_page_only_once_its_noise_is_done, about 145 s into that test, with -n 4 and the other tests of the
# row running beside it: 2 of 2 times on the run of PR #627 (jobs 141051743433 and 141059520460). faulthandler names no native frame (a thread Python has no state for), so the
# goal is a FULL Windows Error Reporting dump of that python.exe (the WER LocalDumps step of PR #629), to read its faulting module and stack.
#
# What it runs. The published engine (`python -m invisible_playwright fetch`) and this branch of the wrapper (main with PR #629), in 8 identical Windows jobs (windows-2022, as the
# part 3 job of e2e.yml). Each job has the setup of that job step by step (screen 1920x1080, Python 3.11, WER LocalDumps of python.exe into $RUNNER_TEMP/invpw-evidence/dumps/python,
# the wrapper and its test deps, the security state, the engine, the GeoIP database) and then loops, until its 70 minutes of wall time, the REAL row of part 3: the files of the row
# `wrapper.e2e.suite.windows.3` of ci/required-suites.json (scripts/ci_verdict.py args, the same list the job reads; tests/test_fakeweb_p4_e2e.py is in it) through
# scripts/run_e2e.py, exactly as the job runs it (-n 4, the same environment). After every iteration the dumps folder is read: when it holds a .dmp the loop stops (the goal is reached).
#
# How to read it: the summary of each job ($GITHUB_STEP_SUMMARY, and summary.md in the artifact `hunt-p4-dump-<shard>-<run id>`): the iterations, the worker deaths ("node down" lines),
# and, for each dump caught, the reader's lines (scripts/ci_wer_dumps.py: the exception, the faulting module and offset). The artifact holds the .dmp files, the log of every iteration
# and the junit. A hunt reports, it does not judge: every job is green whatever happens, and the summary says clearly whether a dump was caught.
#
# Triggered ONLY by a push to `hunt/p4-worker-dump`: no schedule, no dispatch, no pull request. A newer push replaces the run it supersedes.
# -----------------------------------------------------------------------------
name: p4 worker dump hunt
on:
push:
branches: [hunt/p4-worker-dump]
permissions:
contents: read
concurrency:
group: hunt-p4-worker-dump-${{ github.ref }}
cancel-in-progress: true
# Engine and GeoIP downloads go through the release API with this token (as every workflow that runs tests).
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
hunt:
name: shard ${{ matrix.shard }} (windows, part 3)
runs-on: windows-2022
timeout-minutes: 85
# TEMP and TMP on D:\a\_temp, as every Windows job that launches a browser (e2e-windows): on C: the profiles saturate the disk.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
strategy:
fail-fast: false
max-parallel: 8
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository, as on the e2e run (no download, the same bytes every run).
- name: The GeoIP database (made by the repository, same bytes every run)
run: python scripts/ci_lab_geoip.py build
# The files of the part are the rows `wrapper.e2e.suite.windows.N` of ci/required-suites.json: the same list the e2e job and the gate of the candidate run. The row 3 holds
# tests/test_fakeweb_p4_e2e.py whole (a file of the row, not a node id).
- name: The files of part 3 (the row of the suite, in ci/required-suites.json)
run: |
python scripts/ci_verdict.py args --required ci/required-suites.json --suite "wrapper.e2e.suite.windows.3" --os windows > "$RUNNER_TEMP/e2e_args.txt"
echo "$(wc -l < "$RUNNER_TEMP/e2e_args.txt") files in the row"
grep -c "tests/test_fakeweb_p4_e2e.py" "$RUNNER_TEMP/e2e_args.txt" || { echo "::error::tests/test_fakeweb_p4_e2e.py is not in the row"; exit 1; }
- name: The row, in a loop until the budget, until a dump of python.exe is caught
# The loop's own ceiling (the iteration in progress is cut at the budget plus 180 s), inside the job's 85 minutes (setup comes before).
timeout-minutes: 78
env:
PYTHONUNBUFFERED: "1"
# The watchdog of tests/conftest.py, as in the e2e job.
INVPW_TEST_WATCHDOG_FILE: ${{ runner.temp }}/e2e-watchdog.log
# No iteration of the row STARTS after this many seconds of the loop (70 minutes); the end of the budget is only the job's own end, not a verdict.
HUNT_BUDGET_S: "4200"
# Round 1 (run 46178829833) saw 3 worker deaths by access violation and NO dump: WER is not called for a process whose error mode carries
# SEM_NOGPFAULTERRORBOX (0x0002), and a child inherits its parent's error mode. tests/conftest.py clears that bit in every pytest process
# when this is set, and prints the mode it found.
INVPW_HUNT_CLEAR_GPFAULT_ERROR_MODE: "1"
INVPW_HUNT_ERROR_MODE_LOG: ${{ runner.temp }}/invpw-evidence/hunt-p4/error-mode.log
# An iteration takes ~780 s: none starts with less than this left, so no iteration is cut by the budget (round 1 cut 3, read as deaths).
HUNT_ITERATION_S: "900"
run: |
# A hunt reports, it does not judge: a failing iteration (the row is red when the worker dies) is the thing hunted, never a red step.
# GitHub runs this with bash -e: a red iteration must not end the loop (round 1 ended at the first death).
set +e
set -uo pipefail
hunt="$RUNNER_TEMP/invpw-evidence/hunt-p4"
dumps="$RUNNER_TEMP/invpw-evidence/dumps/python"
mkdir -p "$hunt" "$dumps"
if [ -z "${FF:-}" ] || [ ! -e "$FF" ]; then echo "::error::no engine binary (FF='${FF:-}')"; exit 1; fi
mapfile -t ARGS < <(tr -d '\r' < "$RUNNER_TEMP/e2e_args.txt")
cleanup() {
powershell.exe -NoProfile -Command "Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue" > /dev/null 2>&1 || true
}
start=$SECONDS
n=0
while [ $((SECONDS - start + HUNT_ITERATION_S)) -le $((HUNT_BUDGET_S + 180)) ]; do
n=$((n + 1))
t0=$SECONDS
left=$((HUNT_BUDGET_S + 180 - (t0 - start)))
export INVPW_E2E_JUNIT_DIR="$hunt/junit-$n"
mkdir -p "$INVPW_E2E_JUNIT_DIR"
echo "::group::iteration $n (at most ${left}s)"
# THE JOB'S OWN COMMAND (scripts/run_e2e.py: -n 4, the deadline, a junit per pass) with the files of the row of part 3. `timeout` ends the iteration if it outlives its time.
timeout -k 30 "$left" python -u scripts/run_e2e.py "$FF" "${ARGS[@]}" 2>&1 | tee "$hunt/iteration-$n.log"
code=${PIPESTATUS[0]}
echo "::endgroup::"
down=$(grep -c "node down" "$hunt/iteration-$n.log" || true)
av=$(grep -c "Windows fatal exception" "$hunt/iteration-$n.log" || true)
dmps=$(find "$dumps" -maxdepth 1 -name '*.dmp' | wc -l)
printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$n" "$code" "$((SECONDS - t0))" "$down" "$av" "$dmps" >> "$hunt/iterations.tsv"
echo "iteration $n: pytest exit $code in $((SECONDS - t0)) s, node down lines $down, fatal exception lines $av, dumps $dmps"
# What the iteration left (browsers of a cut run) never reaches the next one.
cleanup
if [ "$dmps" -gt 0 ]; then echo "a dump of python.exe is caught: the hunt's goal is reached, the loop stops"; break; fi
sleep 3
done
cp "$RUNNER_TEMP/e2e_args.txt" "$hunt/e2e_args.txt" || true
cp "$RUNNER_TEMP/e2e-watchdog.log" "$hunt/e2e-watchdog.log" 2>/dev/null || true
exit 0
- name: Close every Firefox left
if: always()
shell: pwsh
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python" || true
# The report of the job: always green, and it says whether a dump was caught.
- name: Summary of the job (iterations, worker deaths, dumps with the faulting module)
if: always()
shell: bash
env:
SHARD: ${{ matrix.shard }}
run: |
hunt="$RUNNER_TEMP/invpw-evidence/hunt-p4"
dumps="$RUNNER_TEMP/invpw-evidence/dumps/python"
mkdir -p "$hunt"
tsv="$hunt/iterations.tsv"
iters=0; down=0; av=0; secs=0
if [ -f "$tsv" ]; then
iters=$(wc -l < "$tsv")
down=$(awk -F'\t' '{s+=$4} END {print s+0}' "$tsv")
av=$(awk -F'\t' '{s+=$5} END {print s+0}' "$tsv")
secs=$(awk -F'\t' '{s+=$3} END {print s+0}' "$tsv")
fi
dmps=$(find "$dumps" -maxdepth 1 -name '*.dmp' 2>/dev/null | wc -l)
{
echo "## p4 worker dump hunt, shard $SHARD"
echo
if [ "$dmps" -gt 0 ]; then
echo "**A DUMP WAS CAUGHT: $dmps .dmp file(s) of python.exe in the artifact hunt-p4-dump-$SHARD-${GITHUB_RUN_ID}.**"
else
echo "**No dump was caught in this job.**"
fi
echo
echo "- iterations of the row of part 3: $iters (in $secs s)"
echo "- worker deaths (\`node down\` lines): $down"
echo "- \`Windows fatal exception\` lines: $av"
echo "- dumps: $dmps"
echo
if [ -f "$tsv" ]; then
echo "| iteration | pytest exit | seconds | node down | fatal exception | dumps |"
echo "|---|---|---|---|---|---|"
awk -F'\t' '{printf "| %s | %s | %s | %s | %s | %s |\n", $1, $2, $3, $4, $5, $6}' "$tsv"
echo
fi
if [ "$dmps" -gt 0 ]; then
echo "### What the reader says of each dump (scripts/ci_wer_dumps.py)"
echo
echo '```'
cat "$dumps/summary.txt" 2>/dev/null || python scripts/ci_wer_dumps.py "$dumps" || true
echo '```'
echo
echo "Faulting module lines:"
echo
echo '```'
grep -i "module\|exception\|failed access" "$dumps/summary.txt" 2>/dev/null || true
echo '```'
echo
echo "The tests that died with the worker (node down / fatal exception, in the iteration logs):"
echo
echo '```'
grep -h "node down\|Windows fatal exception\|crashed while running" "$hunt"/iteration-*.log 2>/dev/null | sort | uniq -c | head -20 || true
echo '```'
fi
} > "$hunt/summary.md"
cat "$hunt/summary.md" >> "$GITHUB_STEP_SUMMARY"
- name: Upload the evidence (the dumps, the logs of the iterations, what the tests saved)
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: hunt-p4-dump-${{ matrix.shard }}-${{ github.run_id }}
path: ${{ runner.temp }}/invpw-evidence
if-no-files-found: warn
retention-days: 14
+13
View File
@@ -71,6 +71,19 @@ def _watchdog_open():
def pytest_configure(config):
# HUNT ONLY (hunt/p4-worker-dump, round 2): WER does not run for a process whose error mode carries SEM_NOGPFAULTERRORBOX (0x0002), and a
# child inherits its parent's error mode; round 1 saw 3 access violations and no dump. Each pytest process (the controller and every xdist
# worker) says the mode it was born with and clears that bit, so a crash reaches WER and its LocalDumps.
if os.name == "nt" and os.environ.get("INVPW_HUNT_CLEAR_GPFAULT_ERROR_MODE") == "1":
import ctypes
kernel32 = ctypes.WinDLL("kernel32")
born = kernel32.GetErrorMode()
kernel32.SetErrorMode(born & ~0x0002)
line = "[hunt] pid %d error mode born 0x%04x, now 0x%04x\n" % (os.getpid(), born, kernel32.GetErrorMode())
sys.stderr.write(line)
if os.environ.get("INVPW_HUNT_ERROR_MODE_LOG"):
with open(os.environ["INVPW_HUNT_ERROR_MODE_LOG"], "a", encoding="utf-8") as log:
log.write(line)
# TEMPORARY, with tests/_crash_cores.py (the -11 at the exit of the security state's generate): on Linux every engine of the run, the core's launches
# included, inherits a core limit equal to the hard one, so a crash leaves a core in $INVPW_CORE_DIR (kernel.core_pattern on the e2e jobs).
import _crash_cores