HTTP/2 stream VIOs are read and updated without the VIO mutex
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
- 42/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- cpp
- Bereich
- networking
Rechercherichtung
Read the cited paths in src/proxy/http2/Http2ConnectionState.cc and src/proxy/http2/Http2Stream.cc, along with include/proxy/http2/Http2Stream.h, then trace the VIO mutex and session-thread affinity through src/proxy/http/HttpSM.cc. Determine whether to lock VIO accesses or document and assert the single-thread invariant; done means the chosen invariant is enforced consistently for the listed read and signal paths.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Several HTTP/2 paths touch a stream's read_vio/write_vio while holding only the session mutex, or no lock at all. The consumer (HttpSM) modifies the same VIOs while holding the VIO mutex, which is the stream's own mutex (Http2ConnectionState.cc#L1992). HttpSM::attach_client_session adopts it as the SM mutex (HttpSM.cc#L440).
Http2ConnectionState::rcv_data_frame(Http2ConnectionState.cc#L101) writes into the read VIO's buffer and advancesread_vio.ndoneandread_vio.nbytesthroughupdate_read_length/set_read_done(Http2ConnectionState.cc#L269-L274, Http2Stream.h#L572-L582). It takes no stream or VIO lock.Http2ConnectionState::restart_receivingreads the read VIO's buffer throughread_vio_read_avail()under the session mutex only (Http2ConnectionState.cc#L2238).Http2Stream::signal_read_eventandsignal_write_eventreadread_vio.cont,cont->mutex,opand the disabled flag before taking any lock. They then lockcont->mutex, notvio.mutex(Http2Stream.cc#L942-L951, Http2Stream.cc#L989-L999).
The send path does take stream->mutex before update_sent_count (Http2ConnectionState.cc#L2559).
As far as I can tell, this is not a live data race today. The stream's consumer runs on the session's thread: HttpSM sets its thread affinity in init, TSHttpTxnReenable reschedules onto that affinity, and multiplexed origin sessions are pooled per thread. So the writer and the readers are serialized by running on one EThread rather than by a lock. That invariant isn't stated or checked anywhere. If a consumer of a stream VIO ever runs on a different thread (a plugin, a future change to the session pools), these accesses become data races on ndone, nbytes, cont and the buffer.
Suggested fix: either hold the VIO mutex (the stream mutex) for these accesses, or document the single-thread invariant and add a debug assertion that the stream is only touched from the session's thread.
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
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOEvtl. vergeben @NginxL hat das heute übernommen. OffenBug Good First Issue IOBuffer Network
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
apache/trafficserver#14220 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
MallocAllocator does not check for allocation failureEvtl. vergeben @umrndem hat das heute übernommen. OffenBug Core Good First Issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
apache/trafficserver#14218 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Bug Event System Threads
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
apache/trafficserver#14217 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodEvtl. vergeben @rajeetvk hat das vor 1 Tag übernommen. OffenBug Event System Good First Issue TS API
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
apache/trafficserver#14214 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
HostDBContinuation::init memsets a polymorphic ActionEvtl. vergeben @ANMOLSCRIPT hat das heute übernommen. OffenBug Good First Issue HostDB
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
apache/trafficserver#14204 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in apache/trafficserver
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 2 Tagen
-
bug data-types
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug compatibility difficulty:easy prio:normal
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
NatronGitHub/openfx-misc#524 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation enhancement help wanted P0
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Type: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
openscad/openscad#7360 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag