Skip to content

Add a defensive diagnosis for patch 0058 + hardening - #141

Open
shibco wants to merge 5 commits into
mainfrom
fix/0058-fallback-telemetry
Open

Add a defensive diagnosis for patch 0058 + hardening#141
shibco wants to merge 5 commits into
mainfrom
fix/0058-fallback-telemetry

Conversation

@shibco

@shibco shibco commented Aug 5, 2026

Copy link
Copy Markdown
Owner

#100 and others describe a fault that pins Live on the GDI path at 98.9% of a CPU core against 25.2%, with a corrected user interface.

This patch is a revision for 0058 that further defends against this behaviour. At the same time, this PR adds defensive local telemetry that will help us understand any instance where the behaviour gets out of control.

  • Wine now counts, for each Live window, how many frames it shows on the fast path and how many on the slow fallback path.
  • Wine can tell a window resize from a real fault. A resize changes the compared sizes on every frame. A fault repeats the same two sizes on every frame.
  • When the same two sizes repeat for about two seconds, Wine writes a warning. A second rule catches faults that alternate: more than half of all frames on the fallback path for ten seconds.
  • The warning prints once. It asks the user to open an issue and to copy one log line. That line holds the data we need: both sizes, the display scale state, the window type, the graphics card, the session type, and the desktop.
  • When Live closes a window that ever used the fallback path, Wine writes one summary line with the totals.
  • The launchers keep this one warning channel open. All other Wine debug output stays off, as before.
  • TROUBLESHOOTING.md has a new entry for CPU spikes during mouse input. The mechanism and the test plan are in notes/ABLETON-WINE-GPU-RENDERER.md.

…-up)

The 0058 gate keeps every frame correct but decides per frame and
reports nothing. A persistent coordinate fault can hold a swapchain on
the GDI copy path for a whole session at about one core of CPU, with a
correct screen and no visible sign (issue 100: 98.9% against 25.2% of
a core).

Patch 0071 counts gate decisions per swapchain on the CS thread and
separates resize races from persistent faults: a drag changes the
compared rect pair every frame, a fault repeats it. 120 identical-pair
frames, or a fallback ratio above half for two five-second windows in
a row, print a one-shot warning: two MESSAGE lines that survive
WINEDEBUG=-all plus one machine-parsable err:winediag evidence line.
Destroying a swapchain that ever fell back prints a one-line summary.

The launchers now default to WINEDEBUG=-all,+winediag so winediag
notices reach the log; all other debug output stays off. build-audit
gains the 0071 fingerprint, SERIES.sha256 is refrozen, and BASE.txt
reserves 0070 for the Max for Live font-list cache branch.

TROUBLESHOOTING gains a CPU-spikes entry with the check and report
steps; the GPU renderer note documents the mechanism and the pending
runtime verification: a 0059-reverted build at 125% must warn within
seconds, a ten-second resize drag must not, a healthy session must
stay silent. Compile-verified; wined3d.dll builds clean and carries
both audit fingerprints.
@shibco
shibco requested a review from ClickSentinel August 5, 2026 11:45
Comment thread TROUBLESHOOTING.md Outdated
Comment on lines +73 to +79
- If you started Live from the desktop menu, run
`journalctl --user --since "-15min" | grep -i "present-size mismatch"`.

If that command returns any text related to Wine or Ableton, please
[open an issue](https://github.com/shibco/ableton-linux/issues) and
paste the full log line that contains `Sustained present-size
mismatch`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The destroy summary added in this PR also contains present-size mismatch, and it
fires for transient fallbacks too (measured: a healthy session logged
2 of 2334 presents fell back and still produced the line at exit) — so this grep
as written sends healthy users to the issue tracker looking for a "Sustained" line
their log doesn't have. The trailing colon matches the evidence line only; verified
against real session logs: benign session 0 hits, faulted session exactly 1.

Suggested change
- If you started Live from the desktop menu, run
`journalctl --user --since "-15min" | grep -i "present-size mismatch"`.
If that command returns any text related to Wine or Ableton, please
[open an issue](https://github.com/shibco/ableton-linux/issues) and
paste the full log line that contains `Sustained present-size
mismatch`.
- If you started Live from the desktop menu, run
`journalctl --user --since "-15min" | grep -i "sustained present-size mismatch:"`.
If that command prints anything, please
[open an issue](https://github.com/shibco/ableton-linux/issues) and
paste the whole line. It starts with `err:winediag:` and holds the
data we need.

@ClickSentinel ClickSentinel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tested at 14f6727 on COSMIC/Wayland: build and audit clean, and the warning path exercised for real. With 0059's swapchain.c bracket reverted to resurrect issue 100's fault at 125%, the warning fires at exactly identical-pair 120 and the evidence line alone pins the mechanism — dst (0,0)-(1706,896) client (0,0)-(1365,717), both DPI contexts shown. On the healthy build, a machine-paced 26 s edge drag measured 613 of 3028 presents falling back (20%, longest run 7) with no warning: the resize/fault split holds with wide margin.

Three corrections from the runtime data:

  1. Check 1 in the notes (revert the texture.c hunk) won't fire the warning — that hunk brings back the visual bar while the gate keeps agreeing. Reverting the swapchain.c bracket is what reproduces the sustained fallback; that's the rig above.
  2. Check 3 can't pass as written: the destroy summary fires for transient fallbacks too — a near-idle session logged 2 of 2334 presents fell back and still printed it. Either gate the summary on warned or amend the check; the TROUBLESHOOTING grep currently matches this benign line, see the inline suggestion.
  3. The evidence line prints session unknown desktop unknown on every run. XDG_SESSION_TYPE and XDG_CURRENT_DESKTOP are present in the Unix environment but don't survive the env conversion, so GetEnvironmentVariableA never sees them. Without a Unix-side read the compositor field — the main triage axis for this bug class — is dead for all reporters.

Minor: beta/tester-kit/run-session (hard) and scripts/max9 (default) still set plain WINEDEBUG=-all, dropping the evidence line for the people most likely to report. And if #153 merges first, SERIES_GAPS[0070] needs a manual fix at this branch's rebase — the audit never rechecks gap entries for numbers that exist.

Those items are your call, otherwise, approved.

@shibco

shibco commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Ready for another look @ClickSentinel

@ClickSentinel ClickSentinel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Both must-fixes from the last pass are genuinely fixed, and the merge against upstream/main is clean.

Should fix

  • The idle reset disables the ratio rule for any fault that presents in bursts. Modelling both revisions: an oscillating fault at 100% fallback in 8 s bursts separated by 6 s mouse pauses warns at t=14 s under 14f6727 and stays silent for the whole 80 s / 4801-of-4801-frame run under 0f57214. The cliff is exactly PRESENT_MISMATCH_IDLE_MS — the same fault with 0.5 s pauses still warns at 10 s. The stable-run rule is untouched, so issue 100's persistent shape still fires in 2 s; what narrows is the backstop for the oscillating topology the patch message names as "the danger left". Fix: on an idle gap discard the partial window but keep window_strikes unless the gap is long. Tested at a 30 s strike-reset threshold — the two-bursts-across-a-60-s-gap false positive stays silent and the 8 s/6 s fault warns at 19 s.

  • The evidence line's trailing counters read 0 when the ratio rule fires. swapchain_present_mismatch_warn prints the live consecutive and stable_run, but the ratio path runs on every present including agreeing ones, and the agrees branch zeroes both — an oscillating-fault report reads consecutive 0 identical-pair 0. This commit fixed the same problem for the rectangles by passing last_dst/last_client and left the counters beside them live. Fix: print consecutive_max / stable_run_max, already tracked and meaningful on both paths.

  • The recorded verification predates the code in this commit. The notes now read "Runtime verification is done", but the destroy predicate changed from mismatches to warned here — check 3 ("no destroy summary must appear") is asserted against code that no longer exists, and the run behind it is the one that produced the transient summary. Check 2's cited evidence (613 of 3028 presents, longest run 7) came from a 96 DPI session while check 2 specifies 125%, where the drag false-positive risk is higher. Fix: re-run checks 2 and 3 against 0f57214 and state the scale each measurement ran at.

  • The tester kit lost its forced WINEDEBUG. beta/tester-kit/run-session went from export WINEDEBUG=-all to ${WINEDEBUG:--all,+winediag}, and the unset list above it does not include WINEDEBUG — a tester with an ambient value now silently changes the session the kit exists to make reproducible. Fix: add WINEDEBUG to that unset line, or keep the hard assignment here.

Comment only

  • The journalctl instruction is unverified for a desktop-menu launch. scripts/ableton-live does not redirect its own stderr, so where the line lands is the desktop launcher's choice. On COSMIC, app scopes show stderr at /dev/null for some apps and an inherited pipe for others, and systemd-run --user --scope inherits stdio rather than routing to the journal. A user whose launcher chose /dev/null gets nothing from either instruction. Fix: tee the launcher's stderr to a fixed path and point TROUBLESHOOTING there — one instruction that survives every launch path.

Held

The XDG fix is correct and measured: is_special_env_var in dlls/ntdll/unix/env.c:331 prefixes every XDG_ with WINE_HOST_, and a probe under the built runtime read WINE_HOST_XDG_SESSION_TYPE="wayland" and WINE_HOST_XDG_CURRENT_DESKTOP="COSMIC" with both bare names absent — the len >= sizeof(buf) guard is right against both of GetEnvironmentVariableA's return conventions. +winediag is not a spam channel: the base tree has 58 winediag call sites, 55 ERR_ / 2 WARN_ / 1 FIXME_, no TRACE_. All five user-facing launchers now open it. Registration is complete on all four surfaces, and the idle-reset block is safe on the first present because window_start gates the subtraction.

@shibco

shibco commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

"Should" fix --_--

@ClickSentinel

Copy link
Copy Markdown
Collaborator

"Should" fix --_--

gonna create an issue for the attitude

@shibco

shibco commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

did fix
what's the issue

Truncate live.log only when this launcher is bringing Live up. Every Live
desktop entry runs the same script to hand its file to the running
instance, so the old unconditional truncation wiped that session's log.
Give ableton-live-beta the same capture at live-beta.log. Say five
seconds in the burst rule, in the notes and the patch message, and record
the 30 second reset as a chosen trade.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants