UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIO

Abierto Apto para principiantes
#14,220 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@NginxL ya está trabajando en esto.

Desde el 5/12/2026.

  • #14285 de @NginxL — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp

Línea de trabajo

Lee src/iocore/net/UnixNetVConnection.cc y compara la rama de do_io_write con un lector nulo con el borrado del búfer de do_io_read. Vacía el búfer VIO de escritura cuando reader sea nulo, después comprueba en las pruebas de red pertinentes el comportamiento de cancelación y confirma que get_reader() ya no expone el lector anterior.

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

Descripción

Bug Good First Issue IOBuffer Network

UnixNetVConnection::do_io_read clears the read VIO's buffer when it is called without a buffer (UnixNetVConnection.cc#L220). do_io_write does not do the same. When reader is null it only clears write.enabled (UnixNetVConnection.cc#L245-L247), so write.vio.buffer keeps pointing at the reader, and the MIOBuffer, from the previous write.

The common way to cancel a write is do_io_write(nullptr, 0, nullptr), and the caller then often frees its buffer. HttpSM::state_raw_http_server_open is one example. It starts a one-byte write with _netvc_reader (HttpSM.cc#L1193), then cancels it and frees the MIOBuffer the reader belongs to (HttpSM.cc#L1205-L1206). From then until the next do_io_write, the VC's write VIO holds a dangling reader and MIOBuffer.

Today the net code doesn't dereference the stale reader on these paths, because nbytes is 0 and writing is disabled, but nothing enforces that, and get_reader() on that VIO returns freed memory.

Suggested fix: clear write.vio.buffer in the reader == nullptr branch, as do_io_read already does.


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.