|
@@ -239,7 +239,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
|
|
|
**That ordering refutes the natural reading that the loop was the post-recovery snapshot failing** - which is a real mechanism, just not this one. `shouldSnapshot()` does fire immediately when the WAL is over `max_wal_size_mb` (100), and it fired on the recovery boot: service READY 11:39:16, "Created snapshot at sequence 406829" at 11:39:21, five seconds later and at the sequence recovery ended on, so no writes had intervened. But it runs AFTER READY, and phase 2 never got there. **Note the snapshots directory does NOT discriminate here and must not be used to:** its mtime sat at Oct 16 14:35 through all 120 cycles, which is equally consistent with "no snapshot attempted" and with "the writer builds its buffers in memory and died before writing". Execution progress discriminates; on-disk absence does not.
|
|
**That ordering refutes the natural reading that the loop was the post-recovery snapshot failing** - which is a real mechanism, just not this one. `shouldSnapshot()` does fire immediately when the WAL is over `max_wal_size_mb` (100), and it fired on the recovery boot: service READY 11:39:16, "Created snapshot at sequence 406829" at 11:39:21, five seconds later and at the sequence recovery ended on, so no writes had intervened. But it runs AFTER READY, and phase 2 never got there. **Note the snapshots directory does NOT discriminate here and must not be used to:** its mtime sat at Oct 16 14:35 through all 120 cycles, which is equally consistent with "no snapshot attempted" and with "the writer builds its buffers in memory and died before writing". Execution progress discriminates; on-disk absence does not.
|
|
|
**The consequence for a fix: streaming the snapshot writer prevents phase 1 and therefore prevents the WAL ever reaching the size that causes phase 2 - but it does not make phase 2 survivable.** An operator who meets a 139 MB WAL after some unrelated crash is back in the unsurvivable case. Prevention and survivability are different guarantees and it is worth saying which one is on offer.
|
|
**The consequence for a fix: streaming the snapshot writer prevents phase 1 and therefore prevents the WAL ever reaching the size that causes phase 2 - but it does not make phase 2 survivable.** An operator who meets a 139 MB WAL after some unrelated crash is back in the unsurvivable case. Prevention and survivability are different guarantees and it is worth saying which one is on offer.
|
|
|
Last snapshot before the gap: Oct 16 14:35, sequence 337213. Next: Oct 19 11:39, sequence 406829, after the fix. **~69 hours with none.**
|
|
Last snapshot before the gap: Oct 16 14:35, sequence 337213. Next: Oct 19 11:39, sequence 406829, after the fix. **~69 hours with none.**
|
|
|
- **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.
|
|
|
|
|
|
|
+ **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`). **The fstab line alone is not enough: `findmnt --verify --fstab` warns "your fstab has been modified, but systemd still uses the old version", so a `systemctl daemon-reload` is needed for systemd to generate the `swapfile.swap` unit** - verified afterwards as loaded, active and `RequiredBy=swap.target`. Same shape as the `/etc` mode 0751 trap: correct today and only visible as broken after a reboot. **Verify the entry with `swapon -a`, which is idempotent and reports "already active", NEVER with `swapoff`** - paging 847 MB back into a 1973 MB box would re-kill the thing you just rescued. 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.
|
|
**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.
|
|
**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.
|
|
|
**RUNNING PROD ON SWAP COSTS NOTHING MEASURABLE HERE, AND THAT IS A MEASUREMENT RATHER THAN A HOPE - BECAUSE THE SWAPPED PAGES ARE THE BOOT TRANSIENT AND ARE COLD.** The obvious worry after the fix is that a database holding 866 MB in swap now serves every read through paging. Measured after recovery: `vmstat` shows **si=0, so=0** - no page-in or page-out activity at all, so the swapped pages are the init-time peak sitting cold, not working set being thrashed. A pure DB read through our API (`/documents?limit=5`, no embedding in the path) answers in **3-10 ms**. The one slow number, an 8.17 s vector search, was NOT swap: the same `query_text` repeated answered in **0.267 s and 0.242 s**, which is the provider caching identical text exactly as recorded above, so the 8 s was the cold provider round trip in its known bad tail. **The pure DB read is the control that makes this conclusive** - it removes the provider from the path entirely, and at 3 ms it cannot be hiding a paging cost. Without it, a fast repeat would have been equally consistent with "swap is fine" and "the provider cached it while swap is still slow".
|
|
**RUNNING PROD ON SWAP COSTS NOTHING MEASURABLE HERE, AND THAT IS A MEASUREMENT RATHER THAN A HOPE - BECAUSE THE SWAPPED PAGES ARE THE BOOT TRANSIENT AND ARE COLD.** The obvious worry after the fix is that a database holding 866 MB in swap now serves every read through paging. Measured after recovery: `vmstat` shows **si=0, so=0** - no page-in or page-out activity at all, so the swapped pages are the init-time peak sitting cold, not working set being thrashed. A pure DB read through our API (`/documents?limit=5`, no embedding in the path) answers in **3-10 ms**. The one slow number, an 8.17 s vector search, was NOT swap: the same `query_text` repeated answered in **0.267 s and 0.242 s**, which is the provider caching identical text exactly as recorded above, so the 8 s was the cold provider round trip in its known bad tail. **The pure DB read is the control that makes this conclusive** - it removes the provider from the path entirely, and at 3 ms it cannot be hiding a paging cost. Without it, a fast repeat would have been equally consistent with "swap is fine" and "the provider cached it while swap is still slow".
|