Copilot commented on code in PR #13480:
URL: https://github.com/apache/trafficserver/pull/13480#discussion_r3716590180
##########
include/iocore/net/ConnectionTracker.h:
##########
@@ -448,25 +448,23 @@ inline int
ConnectionTracker::TxnState::reserve()
{
_reserved_p = true;
- // If metric enabled, use metric as count
+ // @a _count is always the authoritative count; the metrics, if enabled,
only mirror it.
+ auto count = ++_g->_count;
if (_g->_count_metric != nullptr) {
ts::Metrics::Gauge::increment(_g->_count_metric);
ts::Metrics::Counter::increment(_g->_count_total_metric);
- return _g->_count_metric->load();
}
- return ++_g->_count;
+ return count;
}
inline void
ConnectionTracker::TxnState::release()
{
if (_reserved_p) {
_reserved_p = false;
- // If metric enabled, use metric as count
+ --_g->_count;
if (_g->_count_metric != nullptr) {
ts::Metrics::Gauge::decrement(_g->_count_metric);
- } else {
- --_g->_count;
}
}
Review Comment:
TxnState::release() decrements Group::_count (and the gauge) but never
removes the Group from the connection-tracker table when the count drops back
to 0. Since the only table erase path is in Group::release(), groups created
for blocked/failed connection attempts can remain in the table indefinitely
with current==0, causing the tracker tables (and
net_rsb.connection_tracker_table_size) to grow over time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]