Http2Stream::do_io_write sets up the write VIO, then returns nullptr when the stream is not writeable

Đang mở
#14,222 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend, networking

Hướng nghiên cứu

Read Http2Stream::do_io_write in src/proxy/http2/Http2Stream.cc around lines 551–573, then inspect main_event around lines 231–237 to understand how write events use write_vio. Check existing HTTP/2 stream tests for coverage of writes on non-writeable streams. Done when that path cannot leave a caller-bound VIO or reader behind after returning nullptr, and the relevant tests pass.

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

Mô tả

Bug HTTP/2

Http2Stream::do_io_write assigns the reader, mutex, cont, nbytes, ndone, vc_server and op = VIO::WRITE to write_vio, and stores the reader in _send_reader. Only after that does it check is_state_writeable() and return nullptr for a stream that can't be written (Http2Stream.cc#L551-L573).

The caller sees a failed write and holds no VIO. The stream, however, now has an active write VIO bound to the caller's continuation and an alias of the caller's reader. Nothing prevents later write events from going out: main_event forwards VC_EVENT_WRITE_READY/WRITE_COMPLETE for &write_vio to write_vio.cont (Http2Stream.cc#L231-L237). So the caller can get callbacks for a VIO it was never given. And if the caller frees its buffer because the write "failed", _send_reader dangles.

I have not traced a specific in-tree sequence that leads to a callback or a dereference after the nullptr return. The inconsistency is in the function itself.

Suggested fix: check is_state_writeable() before modifying write_vio and _send_reader, or reset them before returning nullptr.


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.