Windows: stop full process-table CPU sampling on every session (rebase of #13405) - #14955
Draft
oz-by-warp[bot] wants to merge 1 commit into
Draft
Windows: stop full process-table CPU sampling on every session (rebase of #13405)#14955oz-by-warp[bot] wants to merge 1 commit into
oz-by-warp[bot] wants to merge 1 commit into
Conversation
is_kaspersky_running() enumerated the entire process table with per-process CPU cycle-time sampling on every terminal session bootstrap, just to check whether "avp" (Kaspersky) is running. On Windows each per-process CPU sample issues NtQueryInformationProcess(ProcessCycleTime), which forces KeFlushProcessWriteBuffers -- a synchronous inter-processor interrupt to every logical core. Across the whole process table, in bursts of session inits, on high-core-count machines this keeps all cores spinning at DISPATCH_LEVEL long enough to trip the DPC watchdog and bugcheck the system (DPC_WATCHDOG_VIOLATION 0x133). Confirmed via a kernel dump on a 24-thread Ryzen 9 5900X with Memory Integrity/HVCI enabled. Fix: - refresh_all_processes() now uses a name-only ProcessRefreshKind (all_processes_refresh_kind) instead of the CPU+memory self-poll kind, eliminating the per-process ProcessCycleTime syscalls. Names are still populated, so the Kaspersky name check is unchanged. - Cache is_kaspersky_running() in a OnceLock so the full sweep runs at most once per launch instead of on every session bootstrap. Adds a regression test asserting the full-table sweep samples neither CPU nor memory while the single-PID self-poll still does. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is @npapano42's #13405 rebased onto the latest
master(no content changes), so it can be reviewed against currentmasterand the latest version of the review skills.Why a new branch instead of force-pushing the original PR branch: #13405 is from a fork (
npapano42/warp), and pushing the rebased commit there was rejected — a GitHub App cannot create or update.github/workflows/*without theworkflowspermission, and rebasing onto currentmasternecessarily carries updated workflow files (e.g..github/workflows/changelog_draft.yml). So the rebased commit is pushed to a branch in this repo instead.Original description, from #13405:
Linked Issue
Fixes #13404. Supersedes #13405 (same single commit, rebased).
ready-to-specorready-to-implement.Testing
Original author's testing (Windows 11, Ryzen 9 5900X, HVCI on) is described in #13405, including the regression test
app/src/system/info_tests.rs::all_processes_refresh_kind_does_not_sample_cpu_or_memoryand a standalonesysinfoprobe confirming names are still populated under the name-only refresh.Verification of the rebase itself, on this branch at current
master:Rebase applied cleanly with no conflicts; the diff versus
masteris byte-identical to the original commit's diff../script/format --check→ clean.cargo clippy -p warp --all-targets --tests -- -D warnings→ clean.cargo check -p warp --all-targets→ clean.Running the unit test itself in this sandbox OOM'd while linking the
warplib test binary, so it was not re-executed here; it is a pure assertion overProcessRefreshKindflags and type-checks underclippy --all-targets.I have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-BUG-FIX: Windows — stopped enumerating the full process table with per-process CPU sampling on every terminal session, which could cause DPC_WATCHDOG_VIOLATION / high CPU on machines with many cores.
Conversation: https://app.warp.dev/conversation/3f7e68c2-5574-4bd2-8eb0-42c13931321f
Run: https://oz.warp.dev/runs/019ff261-4ae9-79b5-968a-2e3e41581388
This PR was generated with Oz.