This is an automated email from the ASF dual-hosted git repository. shinrich pushed a commit to branch aviatrix-integrate-ats10 in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit a2f4f3aa28026026978715b1843b416863fd2ce1 Author: Susan Hinrichs <[email protected]> AuthorDate: Mon Sep 11 16:06:00 2023 +0000 memory fixes for ats10 in our environment --- aviatrix/avx_plugins/tee_decrypt/tee_decrypt.cc | 2 +- iocore/net/P_UnixNetVConnection.h | 2 ++ iocore/net/SSLNetVConnection.cc | 6 ++++++ iocore/net/UnixNetVConnection.cc | 21 +++++++++++++-------- proxy/http/HttpSM.cc | 1 + 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/aviatrix/avx_plugins/tee_decrypt/tee_decrypt.cc b/aviatrix/avx_plugins/tee_decrypt/tee_decrypt.cc index 70257c4a1f..23f0635d30 100644 --- a/aviatrix/avx_plugins/tee_decrypt/tee_decrypt.cc +++ b/aviatrix/avx_plugins/tee_decrypt/tee_decrypt.cc @@ -435,7 +435,7 @@ transform_plugin(TSCont contp, TSEvent event, void *edata) return 0; case TS_EVENT_HTTP_READ_RESPONSE_HDR: TSDebug(PLUGIN_NAME, "\tEvent is TS_EVENT_HTTP_READ_RESPONSE_HDR"); - if (TSUserArgGet(txnp, data_arg_index) != nullptr) { + if (data_arg_index != -1 && TSUserArgGet(txnp, data_arg_index) != nullptr) { check_txn_data(txnp); send_response_header(txnp); } diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h index f978c9e2dc..08c6ba691a 100644 --- a/iocore/net/P_UnixNetVConnection.h +++ b/iocore/net/P_UnixNetVConnection.h @@ -115,6 +115,8 @@ public: void get_local_sa(); + bool testInlineClose(); + // these are not part of the pure virtual interface. They were // added to reduce the amount of duplicate code in classes inherited // from NetVConnection (SSL). diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index fb84411516..976f1238a4 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -586,6 +586,9 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) // Continue on if we are still in the handshake if (!getSSLHandShakeComplete()) { int err = 0; + // May get into logic that will clean up the current VC + // Increment the recursion to delay do_io_close cleaup. + this->recursion++; if (get_context() == NET_VCONNECTION_OUT) { ret = sslStartHandShake(SSL_EVENT_CLIENT, err); @@ -626,6 +629,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) this->readSignalDone(VC_EVENT_READ_COMPLETE, nh); } } + this->testInlineClose(); return; // Leave if we are tunneling } } @@ -642,6 +646,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) read.triggered = 0; nh->read_ready_list.remove(this); readSignalError(nh, ETIMEDOUT); + this->testInlineClose(); return; } } @@ -677,6 +682,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) } else { readReschedule(nh); } + this->testInlineClose(); return; } diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index ee7fe8a93f..ac2eae6028 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -98,10 +98,7 @@ read_signal_and_update(int event, UnixNetVConnection *vc) break; } } - if (!--vc->recursion && vc->closed) { - /* BZ 31932 */ - ink_assert(vc->thread == this_ethread()); - vc->nh->free_netevent(vc); + if (vc->testInlineClose()) { return EVENT_DONE; } else { return EVENT_CONT; @@ -132,10 +129,7 @@ write_signal_and_update(int event, UnixNetVConnection *vc) break; } } - if (!--vc->recursion && vc->closed) { - /* BZ 31932 */ - ink_assert(vc->thread == this_ethread()); - vc->nh->free_netevent(vc); + if (vc->testInlineClose()) { return EVENT_DONE; } else { return EVENT_CONT; @@ -1495,3 +1489,14 @@ UnixNetVConnection::set_tcp_congestion_control(int side) return -1; #endif } + +bool +UnixNetVConnection::testInlineClose() +{ + if (!--this->recursion && this->closed) { + ink_assert(this->thread == this_ethread()); + this->nh->free_netevent(this); + return true; + } + return false; +} diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 582cf34737..f3a3304694 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -7487,6 +7487,7 @@ HttpSM::kill_this() server_txn = nullptr; } if (_ua.get_txn()) { + _ua.get_txn()->attach_server_session(nullptr); _ua.get_txn()->transaction_done(); }
