Idle server wakes ~20 times a second (budget 0.2) #646
Closed
opened 2026-10-20 14:28:59 +00:00 by kayg
·
21 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
kayg/calternal#646
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An idle server performs roughly 19.7 wakeups per second against a 0.2 budget. Investigate the periodic list reconciliation task and any other idle server timers. Add a regression test and measure idle wakeups and CPU before and after at 10,000 notes.
Starting work on branch issue/idle-wakeups, based on origin/dev at
1f445a3829. The requested checkout does not contain CLAUDE.md or scripts/fj, so I read the available reference contract and used its scripts/fj wrapper with the installed Forgejo CLI to create this issue.Confirmed in crates/notes/src/home.rs, lines 520 to 532: the reconcile task sleeps for 100 ms before each check, while reconcile_list returns without work when no stale ids or global repair are queued. That is ten empty checks each second per Home and matches the wakeup count in issue 642.
The timer scan found a second idle loop in crates/notes/src/watch.rs, lines 93 to 115. It checks every note file every five seconds only when the system watcher cannot start; Options sets that fallback to five seconds by default. This is needed to detect outside edits without a watcher. I will make that fallback reason explicit in the code comment.
The scan also found the Trash task in crates/notes/src/trash.rs, lines 725 to 739. It waits one minute after startup, then sweeps hourly to remove notes older than the 30 day retention period. The hourly check bounds late cleanup to one hour; I will document why this low frequency idle timer remains.
Baseline measured locally on Linux from the release server at 10,000 notes. The perf harness sampled idle for 60 seconds after startup work and note rooms settled: 19.6 wakeups per second and 0.07% CPU. The harness reads per-thread context switches and process CPU ticks from /proc. This run used one warm run and one cold run on base
1f445a3829.The new regression test failed on the unfixed code as expected. With 1,000 notes and a settled startup scan, it counted 30 list reconcile passes during the allowed three-second idle window. The test uses a per-Home pass hook; the three-second wait only checks that nothing happens.
The reconcile worker now waits on Tokio Notify. Queue updates signal it, and it checks for stale ids or a global repair before running. It waits for the startup scan to finish without polling, keeps the one-second retry after errors, and leaves the bounded repair logic unchanged. The 1,000-note three-second idle regression passes; the same test counted 30 passes before the fix and zero after it.
The updated release server measured locally at 10,000 notes for the same 60-second idle window: 0.00 wakeups per second and 0.00% CPU (zero process CPU ticks). The baseline on the same host and harness was 19.6 wakeups per second and 0.07% CPU. The after run used the same one warm run, one cold run, seed, and idle settings; only the work directory and server build changed.
The timer audit found no other unconditional idle tick. crates/search/src/indexer.rs waits on a deadline only while changed items are queued; crates/search/src/index.rs blocks on its job queue while clean and uses a timeout only after writes. crates/engine/src/runtime.rs sweeps on a later request, while crates/memory/src/lib.rs and crates/notes/src/unload.rs arm one short-lived wait after work. The room actor has one close deadline only while a room is empty. The five-second watcher fallback and hourly Trash sweep are documented in code with their reasons.
The full workspace gate exposed an error-retry regression. I reproduced it by running round4_recorder_outage_bounds_deleted_ids_and_drains_overflow alone: it timed out waiting for the first global publication after 5.30 seconds. On an early recorder error, reconcile_list returns with reconcile_all still queued. The worker had already consumed its notification, so after the one-second delay it waited forever for a new signal. I am preserving the existing test and making the worker signal the retry after its delay.
Finished on branch issue/idle-wakeups. Head:
31c3133def. The 10,000-note local idle sample over 60 seconds measured 0.00 wakeups per second and 0.00% CPU, down from 19.6 wakeups per second and 0.07% CPU on the base. The 1,000-note regression saw 30 passes before the fix and zero after. The recorder-outage retry test and full workspace tests pass. No files outside this branch were pushed; there is no pull request or merge.Final gates. cargo fmt --check exited 0 with no output. The output from the other two gates follows verbatim.
cargo clippy -j4 --workspace --all-targets -- -D warnings (exit 0):
cargo test -j4 --workspace (exit 0):
Independent review (coordinator) of issue/idle-wakeups
31c3133: approve.Lands in the next train with the storage split.
Starting restore regression investigation on issue/restore-regression-idle, base
31c3133def. The job requires fresh branches for updates to open PR branches, so this work will be pushed separately without a PR. I will trace the metadata failure, fix product code, run format, workspace Clippy and workspace tests separately, then test both fixes together on origin/dev. No merge to dev or deployment.The isolated failure is reproduced at
31c3133with temporary product-code probes. The trace is:The failed restore queues list reconciliation. Reconciliation opens the room to recover its journal. A restore replay sees the file already back and returns without retrying metadata. sync_meta then skips that open room even though its list row is absent. Its file-only refresh cannot serve as a barrier for the concurrent actor refresh. The test reaches its assertion first.
The earlier 632-pass report was a real unfiltered workspace run, not a package-only or filtered run. /home/kayg/codex-jobs/idle-wakeups/log.txt records cargo test -j4 --workspace, and /tmp/idle-wakeups-test-final.out contains these exact lines:
The workspace run did not expose the isolated scheduling window. I am adding a deterministic regression for restore replay with a live room and a missing list row, and repairing metadata on the idempotent restore path. The existing assertion remains unchanged.
Branch gate evidence for issue/restore-regression-idle, head
a0a4284e99. fmt, part 1/1. Output verbatim. All commands ran inside the required build slot with a separate target directory and four Cargo build jobs. The combined test is still running.Branch gate evidence for issue/restore-regression-idle, head
a0a4284e99. clippy, part 1/1. Output verbatim. All commands ran inside the required build slot with a separate target directory and four Cargo build jobs. The combined test is still running.Branch gate evidence for issue/restore-regression-idle, head
a0a4284e99. test, part 1/2. Output verbatim. All commands ran inside the required build slot with a separate target directory and four Cargo build jobs. The combined test is still running.Branch gate evidence for issue/restore-regression-idle, head
a0a4284e99. test, part 2/2. Output verbatim. All commands ran inside the required build slot with a separate target directory and four Cargo build jobs. The combined test is still running.Finished. Pushed issue/restore-regression-idle, head
a0a4284e99, based on31c3133def. The original source branch is unchanged because the job's hard rule requires a fresh branch for updates to an open PR branch. No PR was opened.The restore retry previously accepted the live file as complete and skipped its failed list commit. If reconciliation had opened a room, sync_meta skipped the note too. The retry now refreshes metadata through the room and publishes a fresh notes.changed hint only after the row commits; failures stay queued. A short code comment explains why. The original test and its assertion are unchanged. The added regression failed before the fix on each branch and now passes.
The idle job really ran the unfiltered workspace suite and included this test as passing; its saved output proves that. The isolated idle probe captured room=true and have=false. On storage, the original instrumented test passed 21 times with room=false; the controlled missing-row test reproduced the same replay gap there. I have not claimed a separate storage-path cause.
Own branch gates: format, workspace Clippy with warnings denied, and workspace tests all exit 0. Workspace totals: 633 passed, 0 failed, 2 ignored. Full output is quoted in the preceding gate comments.
The first storage workspace run failed in single_root_upgrade_backup_split_cache_delete_and_rollback with a lock conflict. Its isolated recheck, the unchanged full rerun, and the combined run passed. The failed output remains recorded on #642; no change was made to that test or its locking code.
Combined check: temporary detached worktree started at origin/dev
1f445a3829. Both pushed heads merged without conflicts into local merge cd2ca616f0ceb9fffaa18ea3075d1c43ea00d7a2. cargo test -j4 --workspace exited 0: 650 passed, 0 failed, 2 ignored. The temporary worktree was removed after the run. Both product worktrees are clean. Only the two fresh branches were pushed; no merge to dev/main and no deployment.Combined gate summaries, output lines verbatim:
Landed in train AM, #647.
Train AM ran the full suite: fmt, clippy, workspace tests, the build, svelte-check, and every Playwright project in parallel shards.
Results: cr1440 298, cr390 233+197, wk1440 136+162, wk390 141+180, small 20: all passed. wk390 shard 3/3 timed out on every test that used the shard's shared server (its own-server signout tests passed) while the host was saturated; rerun alone at the same head
7f9ceae: 161 passed, 0 failed.Contents:
--data,--state); the default stays one root. Typing and save acks never wait on the HDD. Startup refuses a missing Home, missing state, or a mismatched Home/state pairing; new storage only with--create; deliberate moves use the confirmed localstorage re-pair. Single-root installs upgrade with no manual step. AL's auth.db and invite key live in state; quota counts the Home only. ADR 0062.Reviews: storage split review (3 P1) and re-audit (1 P1, 1 P2), all fixed; idle fix reviewed by the coordinator. 650 workspace tests on the combined branches.
Closing during the 26 Oct handover cleanup: Landed in train AM (#647).