emilk / emilk/egui

eframe: ControlFlow stays Poll after redraws drain, loop spins at idle on Wayland

Open
#8,523 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**
On Linux/Wayland with eframe 0.35, the event loop does not return to Wait after a repaint burst drains. When no redraw is due, eframe sets no control flow, so the last Poll remains in effect. The loop then runs at zero timeout while idle. Captured on one app: about 16k notifier probe reads per second with one core busy. epoll wait times look normal throughout.

**To Reproduce**
1. Minimal eframe app on Wayland (winit 0.30). Request repaints in a burst, then stop.
2. Watch ControlFlow and CPU at idle. The loop stays in Poll.
3. `strace -k` points at the poller zero timeout path, not winit dispatch.

**Expected behavior**
No pending redraw means Wait. Poll holds only while redraws are due.

**Desktop:**
- OS: NixOS, native Wayland. Same binary with `WAYLAND_DISPLAY` unset returns to near zero CPU.
- Version: eframe 0.35. Not rechecked against main head.

**Additional context**
Local workaround is to set Wait when nothing is due. Idle returns to zero with that change. I have that as a small patch and will open a PR if you confirm the semantics. Related: rust-windowing/winit#4668 and #8314 (same Poll handling, resize trigger).

Contributor guide

Open the contributing guide

Research direction

Start by locating eframe 0.35's native event-loop handling and the code that updates ControlFlow after repaint requests drain. Reproduce with a minimal Rust app on native Wayland, request a repaint burst, and observe ControlFlow and idle CPU; the fix is done when no pending redraw returns the loop to Wait and the idle loop no longer spins.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.