Repository navigation
idle: clamp Timer intervals to avoid 32-bit overflow - #11136
leftydevkit wants to merge 1 commit into
Conversation
The idle screensaver and lock timers compute their interval as `seconds * 1000` into a 32-bit int property. secondsFromConfig() only validates finite and >= 0, so a large timeout (e.g. lock=2592000) overflows: 2,591,850,000 ms > INT_MAX (2,147,483,647) wraps negative. Qt then clamps to 1 ms and logs "QBasicTimer::start: negative intervals aren't allowed" on every restart, flooding the shell log until the /run/user tmpfs fills. Clamp both intervals to maxTimerIntervalMs (2^31 - 1). Fixes omacom#11135
|
Reviewed at 8b193d0 and reproduced on an Omarchy ISO worker with the shell linked to the tree under test. The bug is real, and this change fixes the case it describes.
There is a competing fix, #13921, which I think is the better of the two. It caps the value in The canonical issue is #7506; #11135, which this PR closes, was closed as its duplicate. Reviewed by Claude Opus 5.5. The second opinion (Codex Medium) did not run: the reviewer answered, but today's review budget was already spent. So this comparison is one model's judgement. Choosing between this and #13921 is the maintainer's decision, so this is waiting on them. |
|
The overflow bug is real, but this branch looks stale against current Idle timers no longer set screensaverTimer.interval = root.screensaverDelaySeconds * 1000
lockTimer.interval = root.lockDelaySeconds * 1000So clamping only the old property initializers won't help. Prefer #14581 (cap in screensaverTimer.interval = Math.min(root.screensaverDelaySeconds * 1000, root.maxTimerIntervalMs)
lockTimer.interval = Math.min(root.lockDelaySeconds * 1000, root.maxTimerIntervalMs)Happy to close this in favor of #14581 if that one's preferred. |
|
Rechecked against current
Two other open pull requests cap the value in Reviewed by Claude Opus 5.5 by reading the source and doing the trial merge; nothing was run on a worker this time. The second opinion (Codex Medium) was given the three diffs and current |
|
+1 — hit this in the wild today on 4.0.6-1 with Blast radius beyond the quickshell log1.
2. journald gets flooded in parallel, not just the shell log: 3. The overflowed timer survives the config fix. Correcting Workaround
Happy to attach full evidence ( |
Problem
Service.qmlcomputes the idle screensaver/lock timer intervals asseconds * 1000into a 32-bitintproperty.secondsFromConfig()only validates finite and>= 0, so a largeidle.lockoverflows it:Qt clamps the negative interval to 1 ms and logs
QBasicTimer::start: negative intervals aren't allowedon every restart. The shell log then grows without bound (3.28 GB observed), filling the/run/user/<uid>tmpfs. Once full,systemd-run --userfails with ENOSPC, silently breaking launchers that use it (e.g.omarchy-launch-browser— the SUPER+SHIFT+ENTER keybind exits without opening the browser).The overflow is latent in both timers —
lockTimerandscreensaverTimer.Fix
Clamp both intervals to
maxTimerIntervalMs(2³¹ − 1). The multiplication happens in JS doubles, so clamping before the int assignment avoids the wrap; values below the limit are unchanged.Testing
"idle": { "screensaver": 150, "lock": 2592000 }: before, the shell floodsQBasicTimer::start: negative intervals aren't allowedfrom the first idle cycle (150 s) and the log fills the tmpfs. With the clamp applied locally, the interval is2,146,850,000 ms(within range) and the flood does not occur.Math.minreturns the original).Fixes #11135
Filed by deepseek-v4.1-flash via Oh My Pi (omp).