diff --git a/proxy/http3/Http3App.cc b/proxy/http3/Http3App.cc index 7519fe292f7..da9fa624a5b 100644 --- a/proxy/http3/Http3App.cc +++ b/proxy/http3/Http3App.cc @@ -351,9 +351,9 @@ Http3App::_handle_bidi_stream_on_write_complete(int event, VIO *vio) txn->handleEvent(event); } // FIXME There may be data to read - this->_ssn->remove_transaction(txn); this->_qc->stream_manager()->delete_stream(stream_id); this->_streams.erase(stream_id); + delete txn; } // diff --git a/proxy/http3/Http3Session.cc b/proxy/http3/Http3Session.cc index cf543c2bc45..8a422fff599 100644 --- a/proxy/http3/Http3Session.cc +++ b/proxy/http3/Http3Session.cc @@ -38,9 +38,8 @@ HQSession::HQSession(NetVConnection *vc) : ProxySession(vc) HQSession::~HQSession() { - for (HQTransaction *t = this->_transaction_list.head; t; t = static_cast(t->link.next)) { - delete t; - } + // Transactions should be deleted first before HQSesson gets deleted. + ink_assert(this->_transaction_list.head); } void @@ -55,7 +54,6 @@ void HQSession::remove_transaction(HQTransaction *trans) { this->_transaction_list.remove(trans); - delete trans; return; } diff --git a/proxy/http3/Http3Transaction.cc b/proxy/http3/Http3Transaction.cc index 0916c91fc56..6c8e0cf9fd4 100644 --- a/proxy/http3/Http3Transaction.cc +++ b/proxy/http3/Http3Transaction.cc @@ -62,9 +62,14 @@ HQTransaction::HQTransaction(HQSession *session, QUICStreamVCAdapter::IOInfo &in this->_thread = this_ethread(); this->_reader = this->_read_vio_buf.alloc_reader(); + + static_cast(this->_proxy_ssn)->add_transaction(static_cast(this)); } -HQTransaction::~HQTransaction() {} +HQTransaction::~HQTransaction() +{ + static_cast(this->_proxy_ssn)->remove_transaction(this); +} void HQTransaction::set_active_timeout(ink_hrtime timeout_in) @@ -295,7 +300,6 @@ HQTransaction::_signal_write_event() // Http3Transaction::Http3Transaction(Http3Session *session, QUICStreamVCAdapter::IOInfo &info) : super(session, info) { - static_cast(this->_proxy_ssn)->add_transaction(static_cast(this)); QUICStreamId stream_id = this->_info.adapter.stream().id(); this->_header_framer = new Http3HeaderFramer(this, &this->_write_vio, session->local_qpack(), stream_id); @@ -513,8 +517,6 @@ Http3Transaction::has_request_body(int64_t content_length, bool is_chunked_set) // Http09Transaction::Http09Transaction(Http09Session *session, QUICStreamVCAdapter::IOInfo &info) : super(session, info) { - static_cast(this->_proxy_ssn)->add_transaction(static_cast(this)); - SET_HANDLER(&Http09Transaction::state_stream_open); }