Data race on Action::cancelled

Ouverte
#14,193 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
53/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
cpp

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
C++
Étoiles
2k
Forks
903
Merge moyen
4 j 4 h
PR mergées (30 j)
135

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/trafficserver

Toutes les issues de apache/trafficserver

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.