Data race on Action::cancelled

Offen
#14,193 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
53/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
cpp

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
C++
Sterne
2k
Forks
903
Ø Merge
4 T. 4 Std.
Gemergte PRs (30 T.)
135

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/trafficserver

Alle Issues in apache/trafficserver

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.