Skip to content

render: a present that never reaches the compositor leaves a stale frame and nothing retries it #2989

Description

@Xuepoo

Priority: P1 | Area: render | Labels: bug,P1,area:render | Milestone: v0.1.0 | RFC: none | Task: none

The window can keep showing an older frame indefinitely while the app is otherwise healthy, so the UI looks frozen ("nothing responds") even though input and IPC are alive.

Observed on 0.0.34 (pid=603801, 2026-11-08 00:18:35):

  • the user's screen was stuck on one frame;
  • the process was in do_epoll_wait at ~1.6% CPU and answered every bitty ctl request (instance list, window list, view list, terminal list);
  • bitty ctl workspace new + workspace focus repainted the window (the compositor title changed with the newly focused pane), so the runtime re-presented as soon as a state change forced a frame;
  • the same session also logged a phase=idle main-loop stall (24 missed ticks) at that moment, and an earlier phase=cold-commands one (see main loop stalls for seconds in the cold-commands phase (UI freeze while a TUI runs) #2983).

Why this is its own defect

bitty-runtime/src/runtime/present.rs already retries a failed present (#2570: surface_retry with backoff, re-armed on a retry tick). What it does not cover is a present that reports success but never reaches the compositor — a lost frame callback, an acquire that never completes, or a configure that is never followed by a commit. In that state the app believes it is idle, so no retry tick is armed and nothing forces a new frame until an unrelated event arrives.

bitty_render::telemetry already counts present_ok, present_err, acquire_timeout, acquire_outdated, acquire_lost, retry_failures, retry_recoveries and presenter_in_flight-style state in the crash/exit report, so the missing piece is a bounded stuck-present deadline with the same recovery the failed-present path has.

Acceptance

  • A present that is in flight past a bound (or an acquire that never acks) recovers and re-presents without waiting for an unrelated event.
  • The recovery is counted in the existing surface telemetry and reported in the stall/crash report.
  • A test drives a presenter that never acks and asserts the frame is re-presented within the bound.
  • The idle window keeps repainting its last known-good frame after a workspace switch, a resize, and an unfocused/focused transition.

Related: #2980 (a tokenless ack can arrive before the frame's own ack, in the same component), #2983 (the loop-stall evidence).

Activity

  1. added this to the v0.1.0 milestone on Nov 7, 2026
  2. added
    bug
    P1
    area:render
    on Nov 7, 2026
  3. Xuepoo commented on Nov 7, 2026

    @Xuepoo
    ContributorAuthor

    Third occurrence on the same live instance (pid=603801, 0.0.34, uptime 23 h), this time with the watchdog line at the exact moment the user reported the freeze:

    bitty: main-loop stall detected: completed-tick ring gap (capacity=16 missed_at_most=4
      seq=2104505..2104508, phase=chrome-bands, app_uptime=84157633 ms, pid=603801)
    
    • Written 02:21:25; the user reported the frozen screen at the same time.
    • Main thread was in do_epoll_wait at 1.5% CPU, 30 threads, and every bitty ctl verb answered instantly (instance list, workspace list, view list).
    • ~/.local/state/bitty/stall-watchdog-delivery.log at the same time: attempts=57712 failures=429 last=delivered with repeated outcome=timed-out — the watchdog report itself is being delivered unreliably.
    • Forcing a repaint restored the screen immediately: bitty ctl workspace focus ws:1 then workspace focus ws:2. The user confirmed recovery. A view focus change alone does not repaint; a workspace focus change does.
    • Only two plugins are enabled: bitty-terminal.bar (local-path install, 19/19 grants, ~4.3 k lines of Lua, ~12 timer modules) and the bundled bitty-terminal.shell-integration.
    • The bar's host sensor commands are fast when probed (pactl info 58 ms, bluetoothctl show 16 ms, nmcli 95 ms, brightnessctl 11 ms, upower -d 29 ms), so a standing hanging sensor call is not the cause.

    Phase::ChromeBands is set at crates/bitty-terminal/src/terminal_app.rs:1618, immediately before update_chrome_bands() reads mounted UiBlocks from the plugin runtime. Both known stalls (cold-commands, chrome-bands) are in plugin-runtime-adjacent phases, so the open question is whether the main thread can block there and consume frame damage without presenting.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:renderbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions