Migration from QUIC_BUG to QUIC_BUG_V2(bug_id).
Per go/gfe-bug-improvements GFE_BUGs are getting stable IDs to allow for monitoring and alerting. Existing QUIC_BUG instances are changed to have `quic_bug_n_m` ID, where `n` is unique for each file, and `m` is a counter within each file, so we get `QUIC_BUG_V2(quic_bug_123_2)`
PiperOrigin-RevId: 361607447
Change-Id: I7c430eeb831ff92fdcdc867945d691e3bfff7e72
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index d5f7912..82922f1 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -51,7 +51,7 @@
<< level;
return INVALID_PACKET_TYPE;
default:
- QUIC_BUG << level;
+ QUIC_BUG_V2(quic_bug_10752_1) << level;
return INVALID_PACKET_TYPE;
}
}
@@ -194,9 +194,10 @@
void QuicPacketCreator::SetSoftMaxPacketLength(QuicByteCount length) {
QUICHE_DCHECK(CanSetMaxPacketLength());
if (length > max_packet_length_) {
- QUIC_BUG << ENDPOINT
- << "Try to increase max_packet_length_ in "
- "SetSoftMaxPacketLength, use SetMaxPacketLength instead.";
+ QUIC_BUG_V2(quic_bug_10752_2)
+ << ENDPOINT
+ << "Try to increase max_packet_length_ in "
+ "SetSoftMaxPacketLength, use SetMaxPacketLength instead.";
return;
}
if (framer_->GetMaxPlaintextSize(length) <
@@ -238,10 +239,10 @@
QuicPacketCount max_packets_in_flight) {
if (!queued_frames_.empty()) {
// Don't change creator state if there are frames queued.
- QUIC_BUG << "Called UpdatePacketNumberLength with " << queued_frames_.size()
- << " queued_frames. First frame type:"
- << queued_frames_.front().type
- << " last frame type:" << queued_frames_.back().type;
+ QUIC_BUG_V2(quic_bug_10752_3)
+ << "Called UpdatePacketNumberLength with " << queued_frames_.size()
+ << " queued_frames. First frame type:" << queued_frames_.front().type
+ << " last frame type:" << queued_frames_.back().type;
return;
}
@@ -271,10 +272,10 @@
QuicPacketCount max_packets_in_flight) {
if (!queued_frames_.empty()) {
// Don't change creator state if there are frames queued.
- QUIC_BUG << "Called SkipNPacketNumbers with " << queued_frames_.size()
- << " queued_frames. First frame type:"
- << queued_frames_.front().type
- << " last frame type:" << queued_frames_.back().type;
+ QUIC_BUG_V2(quic_bug_10752_4)
+ << "Called SkipNPacketNumbers with " << queued_frames_.size()
+ << " queued_frames. First frame type:" << queued_frames_.front().type
+ << " last frame type:" << queued_frames_.back().type;
return;
}
if (packet_.packet_number > packet_.packet_number + count) {
@@ -336,9 +337,9 @@
frame->stream_frame.data_length < data_size) {
const std::string error_details =
"Client hello won't fit in a single packet.";
- QUIC_BUG << error_details << " Constructed stream frame length: "
- << frame->stream_frame.data_length
- << " CHLO length: " << data_size;
+ QUIC_BUG_V2(quic_bug_10752_5)
+ << error_details << " Constructed stream frame length: "
+ << frame->stream_frame.data_length << " CHLO length: " << data_size;
delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details);
return false;
}
@@ -522,13 +523,13 @@
packet.packet_number_length, packet.encryption_level, &packet_);
for (const QuicFrame& frame : packet.nonretransmittable_frames) {
if (!AddFrame(frame, packet.transmission_type)) {
- QUIC_BUG << "Failed to serialize frame: " << frame;
+ QUIC_BUG_V2(quic_bug_10752_6) << "Failed to serialize frame: " << frame;
return 0;
}
}
for (const QuicFrame& frame : packet.retransmittable_frames) {
if (!AddFrame(frame, packet.transmission_type)) {
- QUIC_BUG << "Failed to serialize frame: " << frame;
+ QUIC_BUG_V2(quic_bug_10752_7) << "Failed to serialize frame: " << frame;
return 0;
}
}
@@ -537,9 +538,10 @@
QUIC_DVLOG(2) << ENDPOINT << "Add padding of size: " << padding_size;
if (!AddFrame(QuicFrame(QuicPaddingFrame(padding_size)),
packet.transmission_type)) {
- QUIC_BUG << "Failed to add padding of size " << padding_size
- << " when serializing ENCRYPTION_INITIAL "
- "packet in coalesced packet";
+ QUIC_BUG_V2(quic_bug_10752_8)
+ << "Failed to add padding of size " << padding_size
+ << " when serializing ENCRYPTION_INITIAL "
+ "packet in coalesced packet";
return 0;
}
}
@@ -588,7 +590,7 @@
QuicDataWriter writer(kMaxOutgoingPacketSize, encrypted_buffer);
size_t length_field_offset = 0;
if (!framer_->AppendPacketHeader(header, &writer, &length_field_offset)) {
- QUIC_BUG << "AppendPacketHeader failed";
+ QUIC_BUG_V2(quic_bug_10752_9) << "AppendPacketHeader failed";
return;
}
@@ -629,18 +631,18 @@
// into one method that takes a QuicStreamFrame, if warranted.
bool omit_frame_length = !needs_padding;
if (!framer_->AppendTypeByte(QuicFrame(frame), omit_frame_length, &writer)) {
- QUIC_BUG << "AppendTypeByte failed";
+ QUIC_BUG_V2(quic_bug_10752_10) << "AppendTypeByte failed";
return;
}
if (!framer_->AppendStreamFrame(frame, omit_frame_length, &writer)) {
- QUIC_BUG << "AppendStreamFrame failed";
+ QUIC_BUG_V2(quic_bug_10752_11) << "AppendStreamFrame failed";
return;
}
if (needs_padding &&
plaintext_bytes_written < MinPlaintextPacketSize(framer_->version()) &&
!writer.WritePaddingBytes(MinPlaintextPacketSize(framer_->version()) -
plaintext_bytes_written)) {
- QUIC_BUG << "Unable to add padding bytes";
+ QUIC_BUG_V2(quic_bug_10752_12) << "Unable to add padding bytes";
return;
}
@@ -659,7 +661,8 @@
GetStartOfEncryptedData(framer_->transport_version(), header),
writer.length(), kMaxOutgoingPacketSize, encrypted_buffer);
if (encrypted_length == 0) {
- QUIC_BUG << "Failed to encrypt packet number " << header.packet_number;
+ QUIC_BUG_V2(quic_bug_10752_13)
+ << "Failed to encrypt packet number " << header.packet_number;
return;
}
// TODO(ianswett): Optimize the storage so RetransmitableFrames can be
@@ -745,7 +748,7 @@
if (packet_.encrypted_buffer != nullptr) {
const std::string error_details =
"Packet's encrypted buffer is not empty before serialization";
- QUIC_BUG << error_details;
+ QUIC_BUG_V2(quic_bug_10752_14) << error_details;
delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET,
error_details);
return false;
@@ -778,10 +781,10 @@
if (!framer_->HasEncrypterOfEncryptionLevel(packet_.encryption_level)) {
// TODO(fayang): Use QUIC_MISSING_WRITE_KEYS for serialization failures due
// to missing keys.
- QUIC_BUG << ENDPOINT << "Attempting to serialize " << header
- << QuicFramesToString(queued_frames_)
- << " at missing encryption_level " << packet_.encryption_level
- << " using " << framer_->version();
+ QUIC_BUG_V2(quic_bug_10752_15)
+ << ENDPOINT << "Attempting to serialize " << header
+ << QuicFramesToString(queued_frames_) << " at missing encryption_level "
+ << packet_.encryption_level << " using " << framer_->version();
return false;
}
@@ -792,14 +795,15 @@
framer_->BuildDataPacket(header, queued_frames_, encrypted_buffer.buffer,
packet_size_, packet_.encryption_level);
if (length == 0) {
- QUIC_BUG << "Failed to serialize " << QuicFramesToString(queued_frames_)
- << " at encryption_level: " << packet_.encryption_level
- << ", needs_full_padding_: " << needs_full_padding_
- << ", pending_padding_bytes_: " << pending_padding_bytes_
- << ", latched_hard_max_packet_length_: "
- << latched_hard_max_packet_length_
- << ", max_packet_length_: " << max_packet_length_
- << ", header: " << header;
+ QUIC_BUG_V2(quic_bug_10752_16)
+ << "Failed to serialize " << QuicFramesToString(queued_frames_)
+ << " at encryption_level: " << packet_.encryption_level
+ << ", needs_full_padding_: " << needs_full_padding_
+ << ", pending_padding_bytes_: " << pending_padding_bytes_
+ << ", latched_hard_max_packet_length_: "
+ << latched_hard_max_packet_length_
+ << ", max_packet_length_: " << max_packet_length_
+ << ", header: " << header;
return false;
}
@@ -820,7 +824,8 @@
GetStartOfEncryptedData(framer_->transport_version(), header), length,
encrypted_buffer_len, encrypted_buffer.buffer);
if (encrypted_length == 0) {
- QUIC_BUG << "Failed to encrypt packet number " << packet_.packet_number;
+ QUIC_BUG_V2(quic_bug_10752_17)
+ << "Failed to encrypt packet number " << packet_.packet_number;
return false;
}
@@ -1042,7 +1047,8 @@
char* buffer,
size_t buffer_len) {
if (HasPendingFrames()) {
- QUIC_BUG << "Try to serialize coalesced packet with pending frames";
+ QUIC_BUG_V2(quic_bug_10752_18)
+ << "Try to serialize coalesced packet with pending frames";
return 0;
}
RemoveSoftMaxPacketLength();
@@ -1062,8 +1068,9 @@
size_t initial_length = ReserializeInitialPacketInCoalescedPacket(
*coalesced.initial_packet(), padding_size, buffer, buffer_len);
if (initial_length == 0) {
- QUIC_BUG << "Failed to reserialize ENCRYPTION_INITIAL packet in "
- "coalesced packet";
+ QUIC_BUG_V2(quic_bug_10752_19)
+ << "Failed to reserialize ENCRYPTION_INITIAL packet in "
+ "coalesced packet";
return 0;
}
buffer += initial_length;
@@ -1206,8 +1213,9 @@
return false;
}
const bool success = AddFrame(frame, next_transmission_type_);
- QUIC_BUG_IF(!success) << "Failed to add frame:" << frame
- << " transmission_type:" << next_transmission_type_;
+ QUIC_BUG_IF_V2(quic_bug_10752_20, !success)
+ << "Failed to add frame:" << frame
+ << " transmission_type:" << next_transmission_type_;
return success;
}
@@ -1215,8 +1223,9 @@
size_t write_length,
QuicStreamOffset offset,
StreamSendingState state) {
- QUIC_BUG_IF(!flusher_attached_) << "Packet flusher is not attached when "
- "generator tries to write stream data.";
+ QUIC_BUG_IF_V2(quic_bug_10752_21, !flusher_attached_)
+ << "Packet flusher is not attached when "
+ "generator tries to write stream data.";
bool has_handshake = QuicUtils::IsCryptoStreamId(transport_version(), id);
MaybeBundleAckOpportunistically();
bool fin = state != NO_FIN;
@@ -1236,7 +1245,8 @@
}
if (!fin && (write_length == 0)) {
- QUIC_BUG << "Attempt to consume empty data without FIN.";
+ QUIC_BUG_V2(quic_bug_10752_22)
+ << "Attempt to consume empty data without FIN.";
return QuicConsumedData(0, false);
}
// We determine if we can enter the fast path before executing
@@ -1259,7 +1269,7 @@
next_transmission_type_, &frame)) {
// The creator is always flushed if there's not enough room for a new
// stream frame before ConsumeData, so ConsumeData should always succeed.
- QUIC_BUG << "Failed to ConsumeData, stream:" << id;
+ QUIC_BUG_V2(quic_bug_10752_23) << "Failed to ConsumeData, stream:" << id;
return QuicConsumedData(0, false);
}
@@ -1323,7 +1333,7 @@
if (bytes_consumed == 0) {
const std::string error_details =
"Failed in CreateAndSerializeStreamFrame.";
- QUIC_BUG << error_details;
+ QUIC_BUG_V2(quic_bug_10752_24) << error_details;
delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET,
error_details);
break;
@@ -1340,8 +1350,9 @@
QuicStreamOffset offset) {
QUIC_DVLOG(2) << "ConsumeCryptoData " << level << " write_length "
<< write_length << " offset " << offset;
- QUIC_BUG_IF(!flusher_attached_) << "Packet flusher is not attached when "
- "generator tries to write crypto data.";
+ QUIC_BUG_IF_V2(quic_bug_10752_25, !flusher_attached_)
+ << "Packet flusher is not attached when "
+ "generator tries to write crypto data.";
MaybeBundleAckOpportunistically();
// To make reasoning about crypto frames easier, we don't combine them with
// other retransmittable frames in a single packet.
@@ -1365,7 +1376,8 @@
// The only pending data in the packet is non-retransmittable frames. I'm
// assuming here that they won't occupy so much of the packet that a
// CRYPTO frame won't fit.
- QUIC_BUG << "Failed to ConsumeCryptoData at level " << level;
+ QUIC_BUG_V2(quic_bug_10752_26)
+ << "Failed to ConsumeCryptoData at level " << level;
return 0;
}
total_bytes_consumed += frame.crypto_frame->data_length;
@@ -1381,8 +1393,9 @@
void QuicPacketCreator::GenerateMtuDiscoveryPacket(QuicByteCount target_mtu) {
// MTU discovery frames must be sent by themselves.
if (!CanSetMaxPacketLength()) {
- QUIC_BUG << "MTU discovery packets should only be sent when no other "
- << "frames needs to be sent.";
+ QUIC_BUG_V2(quic_bug_10752_27)
+ << "MTU discovery packets should only be sent when no other "
+ << "frames needs to be sent.";
return;
}
const QuicByteCount current_mtu = max_packet_length();
@@ -1398,8 +1411,9 @@
FlushCurrentPacket();
// The only reason AddFrame can fail is that the packet is too full to fit in
// a ping. This is not possible for any sane MTU.
- QUIC_BUG_IF(!success) << "Failed to send path MTU target_mtu:" << target_mtu
- << " transmission_type:" << next_transmission_type_;
+ QUIC_BUG_IF_V2(quic_bug_10752_28, !success)
+ << "Failed to send path MTU target_mtu:" << target_mtu
+ << " transmission_type:" << next_transmission_type_;
// Reset the packet length back.
SetMaxPacketLength(current_mtu);
@@ -1416,13 +1430,15 @@
}
const bool flushed =
FlushAckFrame(delegate_->MaybeBundleAckOpportunistically());
- QUIC_BUG_IF(!flushed) << "Failed to flush ACK frame. encryption_level:"
- << packet_.encryption_level;
+ QUIC_BUG_IF_V2(quic_bug_10752_29, !flushed)
+ << "Failed to flush ACK frame. encryption_level:"
+ << packet_.encryption_level;
}
bool QuicPacketCreator::FlushAckFrame(const QuicFrames& frames) {
- QUIC_BUG_IF(!flusher_attached_) << "Packet flusher is not attached when "
- "generator tries to send ACK frame.";
+ QUIC_BUG_IF_V2(quic_bug_10752_30, !flusher_attached_)
+ << "Packet flusher is not attached when "
+ "generator tries to send ACK frame.";
// MaybeBundleAckOpportunistically could be called nestedly when sending a
// control frame causing another control frame to be sent.
QUIC_BUG_IF(GetQuicReloadableFlag(quic_single_ack_in_packet2) &&
@@ -1444,7 +1460,7 @@
return false;
}
const bool success = AddFrame(frame, next_transmission_type_);
- QUIC_BUG_IF(!success) << "Failed to flush " << frame;
+ QUIC_BUG_IF_V2(quic_bug_10752_31, !success) << "Failed to flush " << frame;
}
return true;
}
@@ -1466,7 +1482,8 @@
flusher_attached_ = false;
if (GetQuicFlag(FLAGS_quic_export_write_path_stats_at_server)) {
if (!write_start_packet_number_.IsInitialized()) {
- QUIC_BUG << "write_start_packet_number is not initialized";
+ QUIC_BUG_V2(quic_bug_10752_32)
+ << "write_start_packet_number is not initialized";
return;
}
QUIC_SERVER_HISTOGRAM_COUNTS(
@@ -1499,8 +1516,9 @@
MessageStatus QuicPacketCreator::AddMessageFrame(QuicMessageId message_id,
QuicMemSliceSpan message) {
- QUIC_BUG_IF(!flusher_attached_) << "Packet flusher is not attached when "
- "generator tries to add message frame.";
+ QUIC_BUG_IF_V2(quic_bug_10752_33, !flusher_attached_)
+ << "Packet flusher is not attached when "
+ "generator tries to add message frame.";
MaybeBundleAckOpportunistically();
const QuicByteCount message_length = message.total_length();
if (message_length > GetCurrentLargestMessagePayload()) {
@@ -1512,7 +1530,7 @@
QuicMessageFrame* frame = new QuicMessageFrame(message_id, message);
const bool success = AddFrame(QuicFrame(frame), next_transmission_type_);
if (!success) {
- QUIC_BUG << "Failed to send message " << message_id;
+ QUIC_BUG_V2(quic_bug_10752_34) << "Failed to send message " << message_id;
delete frame;
return MESSAGE_STATUS_INTERNAL_ERROR;
}
@@ -1576,7 +1594,8 @@
return serialized_frame_length;
}
if (BytesFree() < serialized_frame_length) {
- QUIC_BUG << ENDPOINT << "Frame does not fit: " << frame;
+ QUIC_BUG_V2(quic_bug_10752_35)
+ << ENDPOINT << "Frame does not fit: " << frame;
return 0;
}
// Please note bytes_free does not take |frame|'s expansion into account.
@@ -1790,8 +1809,9 @@
bool success = AddFrame(QuicFrame(QuicPaddingFrame(padding_bytes)),
packet_.transmission_type);
- QUIC_BUG_IF(!success) << "Failed to add padding_bytes: " << padding_bytes
- << " transmission_type: " << packet_.transmission_type;
+ QUIC_BUG_IF_V2(quic_bug_10752_36, !success)
+ << "Failed to add padding_bytes: " << padding_bytes
+ << " transmission_type: " << packet_.transmission_type;
}
bool QuicPacketCreator::IncludeNonceInPublicHeader() const {
@@ -1916,7 +1936,7 @@
const std::string error_details =
absl::StrCat("Cannot send stream data with level: ",
EncryptionLevelToString(packet_.encryption_level));
- QUIC_BUG << error_details;
+ QUIC_BUG_V2(quic_bug_10752_37) << error_details;
delegate_->OnUnrecoverableError(QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA,
error_details);
return true;
@@ -2009,7 +2029,7 @@
if (creator_->packet_.encrypted_buffer == nullptr) {
const std::string error_details = "Failed to SerializePacket.";
- QUIC_BUG << error_details;
+ QUIC_BUG_V2(quic_bug_10752_38) << error_details;
creator_->delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET,
error_details);
}