endpoints: a far-future event panics inside write_lock and poisons it, so every later write returns 500 until restart
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start in aw-server/src/endpoints/bucket.rs, where bucket_events_create and bucket_events_heartbeat call event_range() while holding write_lock. The overflow comes from Event::calculate_endtime() in aw-models/src/event.rs (line 43), which uses plain +. Reproduce with the Rocket local client using a far-future timestamp, then confirm the endpoint returns 400 and that later writes still succeed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In aw-server/src/endpoints/bucket.rs, both bucket_events_create and bucket_events_heartbeat call event_range() while holding state.write_lock (write_lock.lock().unwrap(), lines ~179 and ~224). event_range() calls Event::calculate_endtime() (aw-models/src/event.rs:43), which adds the duration with a plain +. That addition panics when the result overflows chrono's range.
An event with a far-future timestamp and a valid duration (< 292 years) therefore panics inside the lock and poisons the Mutex. Every later lock().unwrap() then panics too, so all event writes return 500 until the server restarts: every watcher's heartbeats, event creates, single and bulk deletes. The datastore's own range check (event_nanos) would return a clean 400, but it runs after this point.
Repro (Rocket local client, upstream master ea6f09c):
POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=1
{"timestamp":"+262000-01-01T00:00:00Z","duration":9e9,"data":{}}
-> 500 (panic: `DateTime + TimeDelta` overflowed)
POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=1
{"timestamp":"2026-01-01T00:00:00Z","duration":0,"data":{}}
-> 500 (and the same for POST .../events and DELETE .../events/1)
POST .../events with the same far-future event gives the same result. A browser extension can send it too: the default CORS rule admits moz-extension:// origins for aw-watcher-web-* buckets. So one buggy client clock or extension takes data collection down for every watcher, silently, until restart.
Suggested fix
- Compute the range with
checked_add_signedand return 400 before taking the lock. Or validate the event's range first and take the lock after. - Stop the lock from failing permanently, e.g.
lock().unwrap_or_else(PoisonError::into_inner). It guards only ordering and protects no invariant that a panic could break.
Found in a verified review pass over the endpoints. No PR from me yet, because I already have three open from this pass (#869, #870, #871).
- Lingua principale
- Rust
- Stelle
- 322
- Fork
- 107
- Merge medio
- 2g 16h
- PR unite (30g)
- 25
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 ActivityWatch/aw-server-rust
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ActivityWatch/aw-server-rust#883 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ActivityWatch/aw-server-rust#872 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ActivityWatch/aw-server-rust#798 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
query: categorize rules can pin unbounded memory in the regex cache and run past query_timeoutForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
ActivityWatch/aw-server-rust#893 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
aw-client CLI ignores aw-client.toml host/portForse già presa @TimeToBuildBob l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
ActivityWatch/aw-server-rust#888 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ActivityWatch/aw-server-rust
Issue simili
-
area: cli good first issue type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
renaming a provider to a taken name fails with a raw sql errorForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea:storage kind:bug priority:p3 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug bugfix
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
storytold/photocraft#16975 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
expo/exact#1716 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno