HTTP/2 stream VIOs are read and updated without the VIO mutex

Đang mở
#14,221 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
networking

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug HTTP/2

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).

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

Ngôn ngữ chính
C++
Star
2k
Fork
903
Merge trung bình
4 ngày 4 giờ
Pull request đã merge (30 ngày)
135

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/trafficserver

Tất cả issue của apache/trafficserver

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.