Investigating a report of Spotlight crashing on macOS Monterey. Two driven boots of `macos-12` (macOS 12.7.6, 21H1320), x86 macOS / Linux Vulkan, at `ccefe3b0` — 19 rounds and 13 rounds of open, type a query, walk the results list, close. **It does not reproduce.** - Spotlight's pid is **390 before and 390 after** the second boot's 13 rounds, so it did not die and relaunch — the check `pgrep` alone cannot make. - No guest kernel panic in either boot's stdout, which is the verdict that outranks a probe's own exit. - No new crash report in `~/Library/Logs/DiagnosticReports` or `/Library/Logs/DiagnosticReports`. The newest entries are `bluetoothd` and analytics files that predate the boot. - Dock alive at the end of both runs. - The typed state photographs correctly: the search field holds "safari", the results list is populated and categorised, the top hit is highlighted and the preview pane is drawn. The vibrancy surface behind it composites correctly. - The device's own window over the rounds holds six `sampled_resident_reclaimed`, five `translation_deferred`, and four `type4_backing_fail` — each of the four paired with its own `type4_backing_recovered` 1-10 ms later, which is the guest finishing a mapping the device asked about early. No loss. What that negative does *not* cover, stated so nobody reads it as broader than it is: one rail, one snapshot, one input pattern, keyboard-only, no results opened by Return, and nothing typed that would reach a network or index-rebuild path. A crash that needs a particular query, a cold Spotlight index, or a mouse-driven result would not have been found here. Also fixes the probe flaw that boot exposed: `cmd+space` *toggles*, so a round starting with the window already open closed it and typed into whatever had focus — one round in three photographed a bare desktop. It now escapes first, so every round starts from the same state whatever the last one left behind.
129 lines
5.7 KiB
Bash
Executable File
129 lines
5.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Open Spotlight, type into it, and record what the guest and this device did.
|
|
#
|
|
# spotlight-probe.sh <outdir> <seconds>
|
|
#
|
|
# Same (outdir, seconds) interface as the other probes, so it drops into
|
|
# `kb/harness/ab.sh` as `AB_PROBE`.
|
|
#
|
|
# # Why Spotlight is worth its own probe
|
|
#
|
|
# Spotlight's window is the guest's heaviest *vibrancy* surface: a live blur of
|
|
# whatever is behind it, resized on every keystroke as results arrive, over a
|
|
# desktop that keeps compositing underneath. Nothing else a rail reaches by
|
|
# default combines a live backdrop blur with a window whose geometry changes
|
|
# several times a second, and this device has three rails that care —
|
|
# the sampled-image resolve, the render-target registry keyed on geometry, and
|
|
# the writeback.
|
|
#
|
|
# It is driven from the host over QMP and needs no guest tooling: `cmd+space`
|
|
# and typed ASCII, which is exactly what `AGENTS.md` says to reach for. That
|
|
# matters here because the failure under investigation is a *crash*, and a probe
|
|
# that needs ssh cannot survive the thing it is measuring.
|
|
#
|
|
# # What it collects, and why each is needed
|
|
#
|
|
# A crash inside the guest is invisible to every counter this device has: the
|
|
# device sees a window disappear, which is what a window closing looks like. So
|
|
# the probe takes the guest's own record afterwards — the crash reports macOS
|
|
# writes for a process that died — and it does that *after* the measured window,
|
|
# over ssh, bounded by `timeout`, so a wedged guest cannot hang the run.
|
|
set -u
|
|
OUT="${1:?outdir}"; SECS="${2:-30}"
|
|
REPO=/home/aneesiqbal/Projects/steelbrain/reims-vgpu
|
|
export QMP_SOCK="${QMP_SOCK:-$REPO/vm/disks/run/qmp.sock}"
|
|
Q="$REPO/scripts/qmp/qmp.py"
|
|
FAILLOG=/tmp/reims-vgpu-fail.log
|
|
# What to type. Several rounds of a query that matches a lot (so the results
|
|
# list grows and the window resizes) alternating with one that matches little.
|
|
QUERIES="${SPOTLIGHT_QUERIES:-safari system preferences terminal calculator}"
|
|
mkdir -p "$OUT"
|
|
|
|
# Park the pointer away from the Dock and any hover target.
|
|
"$Q" move 4 4 >/dev/null 2>&1
|
|
sleep 1
|
|
|
|
OFFSET=$(stat -c %s "$FAILLOG")
|
|
echo "spotlight probe: queries='$QUERIES' secs=$SECS"
|
|
|
|
# The pid before, so "it did not crash" is a comparison and not an observation
|
|
# that some process of that name exists. A relaunched Spotlight has the same
|
|
# name and a different pid, which is exactly the case a `pgrep` alone misreads.
|
|
timeout 30 ssh -o BatchMode=yes macos-vm 'pgrep -x Spotlight' \
|
|
>"$OUT/pid-before.txt" 2>/dev/null
|
|
|
|
end=$(( SECONDS + SECS ))
|
|
round=0
|
|
while [ $SECONDS -lt $end ]; do
|
|
for q in $QUERIES; do
|
|
[ $SECONDS -lt $end ] || break
|
|
round=$(( round + 1 ))
|
|
# cmd+space *toggles*, so a round that starts with the window already open
|
|
# closes it instead and types into whatever has focus. Escaping first makes
|
|
# the starting state the same every round whatever the last one left behind
|
|
# — without it, one round in three photographed a bare desktop.
|
|
#
|
|
# `meta_l` is Command in QEMU's qcode names, which is not free choice — see
|
|
# `scripts/qmp/qmp.py`'s table.
|
|
"$Q" key esc >/dev/null 2>&1
|
|
sleep 1
|
|
"$Q" key meta_l+spc >/dev/null 2>&1
|
|
sleep 2
|
|
# Typed a character at a time by the helper, which is what makes the window
|
|
# re-layout repeatedly rather than once.
|
|
"$Q" type "$q" >/dev/null 2>&1
|
|
sleep 3
|
|
# Photograph the *typed* state on the first round of each pass. A probe that
|
|
# only photographs the end shows an empty search field, which is what a
|
|
# closed Spotlight and a Spotlight that never received a keystroke both look
|
|
# like — and the second is a probe bug reported as a clean result.
|
|
if [ $round -le 3 ]; then
|
|
"$REPO/scripts/screenshot-when-kde-plasma-host/screenshot-when-kde-plasma-host.sh" \
|
|
-o "$OUT/typed-$round.png" >/dev/null 2>&1
|
|
fi
|
|
# Walk the results list and open the top hit: the list is what resizes the
|
|
# window, and launching is what makes the guest tear the vibrancy surface
|
|
# down while something else is being composited in front of it.
|
|
"$Q" key down >/dev/null 2>&1
|
|
sleep 1
|
|
"$Q" key down >/dev/null 2>&1
|
|
sleep 1
|
|
# Escape closes it; the next round opens it again, so the blur surface is
|
|
# created and destroyed once per round rather than living for the window.
|
|
"$Q" key esc >/dev/null 2>&1
|
|
sleep 1
|
|
echo "round $round: $q" >>"$OUT/rounds.log"
|
|
done
|
|
done
|
|
|
|
timeout 30 ssh -o BatchMode=yes macos-vm 'pgrep -x Spotlight' \
|
|
>"$OUT/pid-after.txt" 2>/dev/null
|
|
|
|
"$REPO/scripts/screenshot-when-kde-plasma-host/screenshot-when-kde-plasma-host.sh" \
|
|
-o "$OUT/screen.png" >/dev/null 2>&1 || echo "screenshot failed" >>"$OUT/rounds.log"
|
|
|
|
tail -c "+$(( OFFSET + 1 ))" "$FAILLOG" >"$OUT/window.log"
|
|
|
|
# The guest's own record. Bounded on the host side per `AGENTS.md`: a host-side
|
|
# `timeout` does not kill the remote process, so each of these is issued once and
|
|
# never retried.
|
|
{
|
|
echo "===== crash reports (user) ====="
|
|
timeout 60 ssh -o BatchMode=yes macos-vm \
|
|
'ls -lt ~/Library/Logs/DiagnosticReports/ 2>/dev/null | head -40' 2>&1
|
|
echo "===== crash reports (system) ====="
|
|
timeout 60 ssh -o BatchMode=yes macos-vm \
|
|
'ls -lt /Library/Logs/DiagnosticReports/ 2>/dev/null | head -40' 2>&1
|
|
echo "===== is Spotlight alive ====="
|
|
timeout 30 ssh -o BatchMode=yes macos-vm \
|
|
'pgrep -lf Spotlight; pgrep -x Dock >/dev/null && echo dock=alive || echo dock=GONE' 2>&1
|
|
echo "===== newest crash report body ====="
|
|
timeout 60 ssh -o BatchMode=yes macos-vm \
|
|
'f=$(ls -t ~/Library/Logs/DiagnosticReports/*.ips /Library/Logs/DiagnosticReports/*.ips 2>/dev/null | head -1); \
|
|
echo "file=$f"; [ -n "$f" ] && head -120 "$f"' 2>&1
|
|
} >"$OUT/guest-reports.log" 2>&1
|
|
|
|
ANALYZE="${ANIM_ANALYZE:-}"
|
|
[ -n "$ANALYZE" ] && [ -f "$ANALYZE" ] && python3 "$ANALYZE" "$OUT/window.log"
|
|
exit 0
|