Data race on Action::cancelled

Abierto
#14,193 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
53/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
C++
Estrellas
2k
Forks
903
Merge medio
4 d 4 h
PR fusionados (30 d)
135

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/trafficserver

Todos los issues de apache/trafficserver

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.