Improve logging for BandwidthSampler map size bug entry.
gfe-relnote: extra details in a GFE_BUG call. Not flag-protected.
PiperOrigin-RevId: 263353963
Change-Id: Ie039f8d91fea6b79796975e975b9cc9d6c0a9c73
diff --git a/quic/core/congestion_control/bandwidth_sampler.cc b/quic/core/congestion_control/bandwidth_sampler.cc
index 39c7051..37f678d 100644
--- a/quic/core/congestion_control/bandwidth_sampler.cc
+++ b/quic/core/congestion_control/bandwidth_sampler.cc
@@ -41,6 +41,7 @@
}
BandwidthSampler::BandwidthSampler(
+ const QuicUnackedPacketMap* unacked_packet_map,
QuicRoundTripCount max_height_tracker_window_length)
: total_bytes_sent_(0),
total_bytes_acked_(0),
@@ -51,6 +52,7 @@
is_app_limited_(false),
connection_state_map_(),
max_tracked_packets_(GetQuicFlag(FLAGS_quic_max_tracked_packet_count)),
+ unacked_packet_map_(unacked_packet_map),
max_ack_height_tracker_(max_height_tracker_window_length),
total_bytes_acked_after_last_ack_event_(0) {}
@@ -88,9 +90,18 @@
if (!connection_state_map_.IsEmpty() &&
packet_number >
connection_state_map_.last_packet() + max_tracked_packets_) {
- QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
- "number "
- "of tracked packets.";
+ if (unacked_packet_map_ != nullptr) {
+ QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
+ "number of tracked packets. First tracked: "
+ << connection_state_map_.first_packet()
+ << "; last tracked: " << connection_state_map_.last_packet()
+ << "; least unacked: " << unacked_packet_map_->GetLeastUnacked()
+ << "; largest observed: "
+ << unacked_packet_map_->largest_acked();
+ } else {
+ QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
+ "number of tracked packets.";
+ }
}
bool success =
diff --git a/quic/core/congestion_control/bandwidth_sampler.h b/quic/core/congestion_control/bandwidth_sampler.h
index 6af16b7..93ec351 100644
--- a/quic/core/congestion_control/bandwidth_sampler.h
+++ b/quic/core/congestion_control/bandwidth_sampler.h
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_time.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
+#include "net/third_party/quiche/src/quic/core/quic_unacked_packet_map.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
namespace quic {
@@ -241,8 +242,8 @@
// connection is app-limited, the approach works in other cases too.
class QUIC_EXPORT_PRIVATE BandwidthSampler : public BandwidthSamplerInterface {
public:
- explicit BandwidthSampler(
- QuicRoundTripCount max_height_tracker_window_length);
+ BandwidthSampler(const QuicUnackedPacketMap* unacked_packet_map,
+ QuicRoundTripCount max_height_tracker_window_length);
~BandwidthSampler() override;
void OnPacketSent(QuicTime sent_time,
@@ -378,6 +379,11 @@
// Maximum number of tracked packets.
const QuicPacketCount max_tracked_packets_;
+ // The main unacked packet map. Used for outputting extra debugging details.
+ // May be null.
+ // TODO(vasilvv): remove this once it's no longer useful for debugging.
+ const QuicUnackedPacketMap* unacked_packet_map_;
+
// Handles the actual bandwidth calculations, whereas the outer method handles
// retrieving and removing |sent_packet|.
BandwidthSample OnPacketAcknowledgedInner(
diff --git a/quic/core/congestion_control/bandwidth_sampler_test.cc b/quic/core/congestion_control/bandwidth_sampler_test.cc
index 9e36bdc..aeff976 100644
--- a/quic/core/congestion_control/bandwidth_sampler_test.cc
+++ b/quic/core/congestion_control/bandwidth_sampler_test.cc
@@ -33,7 +33,8 @@
class BandwidthSamplerTest : public QuicTest {
protected:
BandwidthSamplerTest()
- : sampler_(/*max_height_tracker_window_length=*/0), bytes_in_flight_(0) {
+ : sampler_(nullptr, /*max_height_tracker_window_length=*/0),
+ bytes_in_flight_(0) {
// Ensure that the clock does not start at zero.
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
}
diff --git a/quic/core/congestion_control/bbr2_misc.cc b/quic/core/congestion_control/bbr2_misc.cc
index e2fc8f0..a527417 100644
--- a/quic/core/congestion_control/bbr2_misc.cc
+++ b/quic/core/congestion_control/bbr2_misc.cc
@@ -83,7 +83,7 @@
float cwnd_gain,
float pacing_gain)
: params_(params),
- bandwidth_sampler_(params->initial_max_ack_height_filter_window),
+ bandwidth_sampler_(nullptr, params->initial_max_ack_height_filter_window),
min_rtt_filter_(initial_rtt, initial_rtt_timestamp),
cwnd_gain_(cwnd_gain),
pacing_gain_(pacing_gain) {}
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc
index bea0d00..efae7c5 100644
--- a/quic/core/congestion_control/bbr_sender.cc
+++ b/quic/core/congestion_control/bbr_sender.cc
@@ -90,7 +90,7 @@
random_(random),
stats_(stats),
mode_(STARTUP),
- sampler_(kBandwidthWindowSize),
+ sampler_(unacked_packets, kBandwidthWindowSize),
round_trip_count_(0),
max_bandwidth_(kBandwidthWindowSize, QuicBandwidth::Zero(), 0),
max_ack_height_(kBandwidthWindowSize, 0, 0),