This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b2e94d9df2 Http2ConnectionState::restart_receiving: check for closed 
peer (#11410)
b2e94d9df2 is described below

commit b2e94d9df20e54f66dd744c4f9832785ab942216
Author: Brian Neradt <[email protected]>
AuthorDate: Mon Jun 3 13:54:19 2024 -0500

    Http2ConnectionState::restart_receiving: check for closed peer (#11410)
    
    I noticed a crash in obtaining the peer's session window in which the
    session's netvc was nullptr. Digging into the backtrace, this seems to
    have occurred because restart_receiving was called for a closed session.
    This patch addresses this by handling this situation.
---
 src/proxy/http2/Http2CommonSession.cc   | 3 +++
 src/proxy/http2/Http2ConnectionState.cc | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/src/proxy/http2/Http2CommonSession.cc 
b/src/proxy/http2/Http2CommonSession.cc
index b17da6def1..fb23db57e8 100644
--- a/src/proxy/http2/Http2CommonSession.cc
+++ b/src/proxy/http2/Http2CommonSession.cc
@@ -419,6 +419,9 @@ Http2CommonSession::do_process_frame_read(int event, VIO 
*vio, bool inside_frame
 bool
 Http2CommonSession::_should_do_something_else()
 {
+  if (this->get_proxy_session()->is_peer_closed()) {
+    return false;
+  }
   if (this->_interrupt_reading_frames) {
     this->_interrupt_reading_frames = false;
     return true;
diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index ae739e9c3a..d4e1ac6f2d 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1905,6 +1905,10 @@ Http2ConnectionState::restart_streams()
 void
 Http2ConnectionState::restart_receiving(Http2Stream *stream)
 {
+  if (this->session->get_proxy_session()->is_peer_closed()) {
+    // Cannot restart a closed connection.
+    return;
+  }
   // Connection level WINDOW UPDATE
   uint32_t const configured_session_window = 
this->_get_configured_receive_session_window_size();
   uint32_t const min_session_window =

Reply via email to