Enhance the error message when quic::BandwidthSampler's in-flight packet map exceeds the max number of tracked packets. PiperOrigin-RevId: 346323374 Change-Id: If4f088d314ac305af18eebe2803010a4b7857827
diff --git a/quic/core/congestion_control/bandwidth_sampler.cc b/quic/core/congestion_control/bandwidth_sampler.cc index ee6d6c1..9bbac4f 100644 --- a/quic/core/congestion_control/bandwidth_sampler.cc +++ b/quic/core/congestion_control/bandwidth_sampler.cc
@@ -168,7 +168,9 @@ if (!connection_state_map_.IsEmpty() && packet_number > connection_state_map_.last_packet() + max_tracked_packets_) { - if (unacked_packet_map_ != nullptr) { + if (unacked_packet_map_ != nullptr && !unacked_packet_map_->empty()) { + QuicPacketNumber maybe_least_unacked = + unacked_packet_map_->GetLeastUnacked(); QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum " "number of tracked packets(" << max_tracked_packets_ @@ -179,7 +181,21 @@ << "; number_of_present_entries: " << connection_state_map_.number_of_present_entries() << "; packet number: " << packet_number - << "; unacked_map: " << unacked_packet_map_->DebugString(); + << "; unacked_map: " << unacked_packet_map_->DebugString() + << "; total_bytes_sent: " << total_bytes_sent_ + << "; total_bytes_acked: " << total_bytes_acked_ + << "; total_bytes_lost: " << total_bytes_lost_ + << "; total_bytes_neutered: " << total_bytes_neutered_ + << "; last_acked_packet_sent_time: " + << last_acked_packet_sent_time_ + << "; total_bytes_sent_at_last_acked_packet: " + << total_bytes_sent_at_last_acked_packet_ + << "; least_unacked_packet_info: " + << (unacked_packet_map_->IsUnacked(maybe_least_unacked) + ? unacked_packet_map_ + ->GetTransmissionInfo(maybe_least_unacked) + .DebugString() + : "n/a"); } else { QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum " "number of tracked packets.";
diff --git a/quic/core/quic_transmission_info.cc b/quic/core/quic_transmission_info.cc index 3d33c99..e4295f7 100644 --- a/quic/core/quic_transmission_info.cc +++ b/quic/core/quic_transmission_info.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "net/third_party/quiche/src/quic/core/quic_transmission_info.h" +#include "absl/strings/str_cat.h" namespace quic { @@ -36,4 +37,19 @@ QuicTransmissionInfo::~QuicTransmissionInfo() {} +std::string QuicTransmissionInfo::DebugString() const { + return absl::StrCat( + "{sent_time: ", sent_time.ToDebuggingValue(), + ", bytes_sent: ", bytes_sent, + ", encryption_level: ", EncryptionLevelToString(encryption_level), + ", transmission_type: ", TransmissionTypeToString(transmission_type), + ", in_flight: ", in_flight, ", state: ", state, + ", has_crypto_handshake: ", has_crypto_handshake, + ", has_ack_frequency: ", has_ack_frequency, + ", first_sent_after_loss: ", first_sent_after_loss.ToString(), + ", largest_acked: ", largest_acked.ToString(), + ", retransmittable_frames: ", QuicFramesToString(retransmittable_frames), + "}"); +} + } // namespace quic
diff --git a/quic/core/quic_transmission_info.h b/quic/core/quic_transmission_info.h index 61d1ad0..2c6110b 100644 --- a/quic/core/quic_transmission_info.h +++ b/quic/core/quic_transmission_info.h
@@ -32,6 +32,8 @@ ~QuicTransmissionInfo(); + std::string DebugString() const; + QuicFrames retransmittable_frames; QuicTime sent_time; QuicPacketLength bytes_sent;