Data race on Action::cancelled

Aperta
#14,193 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start by reading include/iocore/eventsystem/Action.h and the listed readers in UnixEThread.cc, ProtectedQueue.cc, PQ-List.cc, DNS.cc, and HostDB.cc to understand how cancellation is synchronized across threads. The issue proposes making cancelled an atomic boolean with acquire/release ordering. Done means addressing the reported unsynchronized accesses and writes, then verifying the relevant event, DNS, and HostDB paths.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug DNS Event System HostDB

Action::cancelled is a plain bool (Action.h#L94). Action::cancel() writes it, and the class requires the caller to hold Action::mutex (Action.h#L51, #L159-L164). Several readers check it on another thread without holding that mutex:

For example, a continuation that cancels an Event scheduled on another thread of the pool writes cancelled on its own thread while the target thread's dispatcher reads it in process_queue() or check_ready(). The same goes for a HostDB or DNS requester that cancels its lookup while the DNS thread finishes it. These are data races on a non-atomic object, which is undefined behavior.

A possible fix is to make cancelled a std::atomic<bool>. The readers only need to observe a cancellation that happened before they took ownership of the Event, so acquire/release ordering is enough.


generated with Claude Opus 5.5 by Josiah VanderZee

Lingua principale
C++
Stelle
2k
Fork
903
Merge medio
4g 4h
PR unite (30g)
135

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/trafficserver

Tutte le issue di apache/trafficserver

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.