Sfoglia il codice sorgente

docs: an OOM line's cpuset= is the trigger, task= is the victim

Five kernel lines from the 2026-10-19 outage name
cpuset=smartbotic-vectorapi.service while task=smartbotic-data, so a
grep for our own service name matches them and reads as vectorapi being
OOM-killed. It was the allocation trigger, not the victim; NRestarts=0
across our three units against 183 on the database is the control.

Notes the corollary worth having: a service can repeatedly cause another
service's death with its own logs staying clean, so 'nothing wrong on my
side' is not exculpatory under global memory pressure.
fszontagh 1 mese fa
parent
commit
e3f14f9772
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      CLAUDE.md

+ 2 - 0
CLAUDE.md

@@ -242,6 +242,8 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **FIXED BY ADDING SWAP, which is a floor under the symptom and not a cure.** 4 GB `/swapfile` plus an `/etc/fstab` line so it survives a reboot (`/etc/fstab` is owned by no package - `dpkg -S` first, per the conffile trap above; backed up to `/etc/fstab.bak-20261019`). Boot then peaked at ~1514 MB RSS **and 818 MB of swap**, settling at 847 MB in use, so the anonymous demand is well ABOVE the 1973 MB box rather than marginally over it. The snapshot peak still scales with the store, and swapping a 400 MB serialise is slow; the structural fix is the database's.
   **THE KILL POINT IS A LOWER BOUND ON THE REQUIREMENT, NEVER THE REQUIREMENT.** Without swap the process died at 1.51 GB anon, and it is tempting to size against that. The kernel STOPPED it there - it never revealed its own peak. Only once swap gave it room did the real figure appear, and it was ~2.3 GB of anonymous demand. Sizing against an OOM kill point under-provisions by however much the process still had left to allocate, which is unknowable from the kill.
   **WHY NOBODY SAW IT, AND THIS IS THE GENERALISABLE PART: A CRASH THAT RESTARTS CLEANLY IS A SILENT CRASH.** systemd brought it back each hour, so the observable was a ~40 s outage once an hour inside consumers' retry budgets - and the database logs it only as `status=9/KILL`, with no line saying a snapshot FAILED. Worse, the run log lives in the database, so during each kill it goes QUIET rather than recording failures: the absence-is-not-information trap this file already records, now in its most expensive form. A consumer reported it only on the day it became permanent. **So "the service is up" and "the service has not been failing" are different claims, and `NRestarts` is the cheap way to tell them apart** - 183 here, which was visible all along and which nobody read. Check it when closing any window, next to `apt-mark showhold`; it is the same class of signal as the `ii`/`hi` column this file has now been read past twice.
+  **GREPPING AN OOM LINE FOR A SERVICE NAME MISREADS IT, AND THE MISREADING IS THE FLATTERING ONE FOR WHOEVER IS GREPPING. `cpuset=` NAMES THE CGROUP THAT TRIGGERED THE ALLOCATION; `task=` AND `task_memcg=` NAME THE VICTIM.** Five kernel lines on 2026-10-19 read `cpuset=smartbotic-vectorapi.service ... task_memcg=/system.slice/smartbotic-database.service, task=smartbotic-data`, so a grep for our own service name matched them and they look exactly like vectorapi being OOM-killed. It never was: ours asked for memory, that request tripped the GLOBAL OOM killer, and the kernel chose the database as the victim because it was the largest. `NRestarts=0` on all three of our units is the control, against 183 on the database from the same command. Under global memory pressure the process that triggers a kill and the process that dies are routinely different, which also means **a service can be a repeated CAUSE of another service's death while its own logs stay perfectly clean** - worth knowing before taking "my service shows nothing wrong" as exculpatory. Read `task=`.
+  **vectorapi itself came through untouched**, up since 2026-10-15 15:56 (the supervised restart after the client library moved) and the runner since 2026-10-13, and it answered **1664 requests with 503** during the permanent phase - correctly classified, naming the real condition, which is the error-slug work doing its job under the one condition nobody arranges deliberately.
   **The pre-flight rule that follows: a headroom measurement needs a RE-MEASUREMENT TRIGGER, not just a date.** "The snapshot survives hourly" was true, dated, and silently became false through ordinary growth - no deploy, no config change, nothing to review. Tie it to a quantity that moves: snapshot file size against free memory, or doc count against the figure the headroom was measured at. A dated measurement with no trigger is a claim that will be believed long after it stops being true, which is precisely the failure this file's maintenance rule exists to prevent - and here the stale claim was MINE, in this file, and it read as reassuring right up to the outage.
 - **A SECOND RESTART IS NOT NEEDED ON 2.17.2, measured rather than reasoned.** Our `KeyStore`/`SettingsStore` bootstraps DO perform the online upgrade after the migration, and the log says so - but with **0 rows and 0 history versions rewritten**, because the collections are already ciphertext through the bare-alias merge. `encryption-verify` then reports `sealed: yes`, `CLEAN`, exit 0. So the window is TWO steps and ONE compaction (upgrade, then start vectorapi), with verify as the branch: plain `CLEAN` means done, `CLEAN (UNSEALED: ...)` means take the reseal inside the window. On 2.17.1 that same flag move requested a reseal that compacted every project, which is where the obsolete three-step plan came from.
   Note the upstream log line still says "old plaintext copies are removed at the next restart" even when it rewrote NOTHING, which contradicts verify's `sealed: yes` and would have an operator restart for no reason. Trust verify.