Watchtower /health and /search share a 1-hour-TTL index handle, serving a replaced inode after an out-of-process reindex
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with web/embeddings.py at STALE_SECONDS and _get_db(), then trace how the index handle is opened and used by /search and /health in web/app.py. Check how reindex replaces the index file and whether its device/inode identity is available for comparison. Done when an out-of-process reindex is detected without waiting for the TTL and search and health use the refreshed index.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Watchtower's web process holds a long-lived index handle that is only reopened after a
one-hour TTL, not when the index file underneath it is replaced. Any reindex performed
by a different process — the hourly cron job, a manual fw index reindex — swaps the
file via os.replace() while the web process keeps its handle on the old inode.
Code path
web/embeddings.py:111—STALE_SECONDS = 3600web/embeddings.py:465-494—_get_db()reopens only once that TTL has elapsedweb/app.py:349-360—/health'schunksfield is read from that same process-global
_dbhandleweb/embeddings.py:754, 1246, 1384, 1501—/searchand/recalluse the same handle
Consequence
/search serves results from the replaced inode for up to an hour after any reindex
the web process did not itself trigger. Newly indexed content is invisible to search for
that window, and nothing surfaces it as stale.
Worse for diagnosis: /health reports chunks from the stale handle while
index_age_seconds on the same JSON line comes from a fresher manifest read. So the health
endpoint can show a recent index age beside a chunk count from an hour-old inode — the one
surface an operator would check to detect this shows a self-consistent-looking pair of
numbers sourced from two different points in time.
This was originally observed downstream as a count mismatch (/health reporting 13242
chunks against a completed reindex that wrote 13346). The observation asked whether
/search was also affected and left it open. Reading the code answers it: yes, the same
handle, so yes.
Note this is not fixed by scheduling the reindex correctly — the downstream task that
installed the hourly job never touched _get_db's TTL, so the file refreshes hourly and
the server does not.
Suggested fix
Invalidate on inode identity rather than elapsed time: stat the index path and reopen when
st_ino/st_dev differ from the open handle's, in addition to the TTL. Cheap, and it
makes the reindex swap self-announcing instead of requiring the reader to wait it out.
Filed from project 1409-sprind under its observation-inbox triage task, confirmed by
code reading on 1.6.769 rather than by reproducing the timing window.
- Lingua principale
- Shell
- Stelle
- 16
- Fork
- 6
- Merge medio
- 6h 24m
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DimitriGeelen/agentic-engineering-framework
-
area:cli bug severity:low status:fixed-on-bleeding-edge triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
DimitriGeelen/agentic-engineering-framework#100 · 5 commenti ·
-
area:cli bug severity:medium status:fixed-on-bleeding-edge triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
DimitriGeelen/agentic-engineering-framework#97 · 5 commenti ·
-
area:context bug severity:low status:fixed-on-bleeding-edge triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
DimitriGeelen/agentic-engineering-framework#96 · 5 commenti ·
-
area:docs bug severity:medium status:in-progress triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DimitriGeelen/agentic-engineering-framework#95 · 4 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
Tutte le issue di DimitriGeelen/agentic-engineering-framework
Issue simili
-
source:reader type:enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
stephrobert/blog-roadmap#115 ·
-
Python Volcengine provider returns failures instead of raising themForse già presa @Ricardo-M-L l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
agent-infra/sandbox#248 ·
-
chore priority:low size:S
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
celo-org/celopedia-skills#98 ·
I maintainer di solito rispondono entro 1 giorno
-
Git for Windows shouldn't be locked on their `.windows.1` versionsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagit windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jenkins-infra/packer-images#3179 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-pr
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kunchenguid/firstmate#7679 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno