Repository navigation
Commit 8aade45
committed
fix(host-agent): net prewarm pending charge, gate ledger gauges on measured, real statfs tmpfs-used, pin watch-channel invariant (findings 2, 3, 4, 5)
- finding 2: RamLedger::register_pending_base_shm now stores the target
file path alongside the expected byte count. sample() nets each
pending charge against that file's own st_blocks (file_allocated_bytes)
instead of holding the full charge outstanding for the whole write
window — the fix for the transient double-charge where a ~19 GiB
dev-brain prewarm at 90% written was under-reporting allocatable_mib
by ~17 GiB (MemAvailable already dropping AND the full charge still
subtracted). New regression test
pending_charge_nets_against_bytes_already_written proves the charge
shrinks as bytes actually land.
- finding 3: the whole HOST_RAM_LEDGER_MIB / HOST_RAM_ALLOCATABLE_MIB /
HOST_BASE_SHM_TMPFS_* gauge-emission block is now gated on
ram_snapshot.measured, so VZ/Process/non-Linux hosts (and a genuine
/proc/meminfo parse failure) stop reporting a permanently-zero gauge
family that reads as "this host has 0 MiB of everything" instead of
"unmeasured" — matches the PR's own acceptance criterion.
- finding 5: HOST_BASE_SHM_TMPFS_USED_MIB was byte-identical to the
base_shm category gauge (a read_dir/st_blocks walk over known
files). tmpfs_stat_mib now also does a real statfs read
(f_blocks - f_bfree) and RamLedgerSnapshot carries a new
base_shm_tmpfs_used_mib field for it, so an unlinked-but-open file or
stray subdir the dir walk can't see is no longer invisible to the
gauge that exists specifically to debug ENOSPC-class tmpfs incidents.
- finding 4: added
ram_ledger_snapshot_round_trips_through_watch_channel, publishing a
RamLedgerSnapshot on a tokio::sync::watch channel and asserting two
independent readers observe byte-identical values to what was
published — pins the "one source of truth" mechanism the heartbeat
and pressure gate rely on.
Review threads:
#561 (comment) (finding 2)
#561 (comment) (finding 3)
#561 (comment) (finding 4)
#561 (comment) (finding 5)1 parent 6db9843 commit 8aade45
4 files changed
Lines changed: 264 additions & 60 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
663 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
664 | 668 | | |
665 | 669 | | |
666 | 670 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1192 | 1210 | | |
1193 | 1211 | | |
1194 | 1212 | | |
1195 | | - | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1196 | 1216 | | |
1197 | 1217 | | |
1198 | 1218 | | |
| |||
0 commit comments