Data race on Action::cancelled
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
- Domaine
- backend, distributed-systems
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
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:
- The EThread dispatcher, before it try-locks the Event's mutex: UnixEThread.cc#L213 (external queue) and UnixEThread.cc#L331 (priority queue).
- ProtectedQueue.cc#L77 in
dequeue_external(), which frees cancelled Events. - PQ-List.cc#L51-L53 in
PriorityEventQueue::check_ready(), which also writescancelled = 0. dns_result()at DNS.cc#L1365, which holds the DNSHandler's mutex, not the requester's.HostDBContinuation::remove_and_trigger_pending_dns()at HostDB.cc#L1160 (under the bucket lock) and HostDB.cc#L1169 (before it locksc->mutexat L1176).
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
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOPeut-être pris @NginxL l’a pris aujourd’hui. OuverteBug Good First Issue IOBuffer Network
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14220 ·
Les mainteneurs répondent en général sous 2 jours
-
MallocAllocator does not check for allocation failurePeut-être pris @umrndem l’a pris aujourd’hui. OuverteBug Core Good First Issue
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14218 · 2 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
THREAD_ALLOC dereferences a null thread while THREAD_FREE falls back to the global allocatorOuverteBug Event System Threads
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14217 ·
Les mainteneurs répondent en général sous 2 jours
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodPeut-être pris @rajeetvk l’a pris il y a 1 jour. OuverteBug Event System Good First Issue TS API
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/trafficserver#14214 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
HostDBContinuation::init memsets a polymorphic ActionPeut-être pris @ANMOLSCRIPT l’a pris aujourd’hui. OuverteBug Good First Issue HostDB
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/trafficserver#14204 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/trafficserver
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
Les mainteneurs répondent en général sous 2 jours
-
bug data-types
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
ClickHouse/clickhouse-cpp#645 ·
Les mainteneurs répondent en général sous 1 jour
-
bug compatibility difficulty:easy prio:normal
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
NatronGitHub/openfx-misc#524 ·
Les mainteneurs répondent en général sous 1 jour
-
[内容提案] 现在C++模块的CMake支持有更新,需要进行同步Ouvertedocumentation enhancement help wanted P0
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Les mainteneurs répondent en général sous 1 jour
-
Type: Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
openscad/openscad#7360 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour