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: 362083283 Change-Id: Ice330337265cec3dc4b81fa4ff50d58fb52f3d34
diff --git a/quic/core/legacy_quic_stream_id_manager.cc b/quic/core/legacy_quic_stream_id_manager.cc index 07403f8..7a5cbc4 100644 --- a/quic/core/legacy_quic_stream_id_manager.cc +++ b/quic/core/legacy_quic_stream_id_manager.cc
@@ -107,11 +107,11 @@ void LegacyQuicStreamIdManager::OnStreamClosed(bool is_incoming) { if (is_incoming) { - QUIC_BUG_IF(num_open_incoming_streams_ == 0); + QUIC_BUG_IF_V2(quic_bug_12720_1, num_open_incoming_streams_ == 0); --num_open_incoming_streams_; return; } - QUIC_BUG_IF(num_open_outgoing_streams_ == 0); + QUIC_BUG_IF_V2(quic_bug_12720_2, num_open_outgoing_streams_ == 0); --num_open_outgoing_streams_; }
diff --git a/quic/core/quic_buffered_packet_store.cc b/quic/core/quic_buffered_packet_store.cc index 8fa53b0..3ba988b 100644 --- a/quic/core/quic_buffered_packet_store.cc +++ b/quic/core/quic_buffered_packet_store.cc
@@ -88,13 +88,16 @@ bool is_chlo, const std::vector<std::string>& alpns, const ParsedQuicVersion& version) { - QUIC_BUG_IF(!GetQuicFlag(FLAGS_quic_allow_chlo_buffering)) + QUIC_BUG_IF_V2(quic_bug_12410_1, + !GetQuicFlag(FLAGS_quic_allow_chlo_buffering)) << "Shouldn't buffer packets if disabled via flag."; - QUIC_BUG_IF(is_chlo && QuicContainsKey(connections_with_chlo_, connection_id)) + QUIC_BUG_IF_V2( + quic_bug_12410_2, + is_chlo && QuicContainsKey(connections_with_chlo_, connection_id)) << "Shouldn't buffer duplicated CHLO on connection " << connection_id; - QUIC_BUG_IF(!is_chlo && !alpns.empty()) + QUIC_BUG_IF_V2(quic_bug_12410_3, !is_chlo && !alpns.empty()) << "Shouldn't have an ALPN defined for a non-CHLO packet."; - QUIC_BUG_IF(is_chlo && !version.IsKnown()) + QUIC_BUG_IF_V2(quic_bug_12410_4, is_chlo && !version.IsKnown()) << "Should have version for CHLO packet."; const bool is_first_packet = @@ -153,7 +156,8 @@ queue.tls_chlo_extractor.IngestPacket(version, packet); // Since this is the first packet and it's not a CHLO, the // TlsChloExtractor should not have the entire CHLO. - QUIC_BUG_IF(queue.tls_chlo_extractor.HasParsedFullChlo()) + QUIC_BUG_IF_V2(quic_bug_12410_5, + queue.tls_chlo_extractor.HasParsedFullChlo()) << "First packet in list should not contain full CHLO"; } // TODO(b/154857081) Reorder CHLO packets ahead of other ones.
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc index 76145c0..44e2ded 100644 --- a/quic/core/quic_config.cc +++ b/quic/core/quic_config.cc
@@ -72,7 +72,7 @@ } uint32_t QuicFixedUint32::GetSendValue() const { - QUIC_BUG_IF(!has_send_value_) + QUIC_BUG_IF_V2(quic_bug_12743_1, !has_send_value_) << "No send value to get for tag:" << QuicTagToString(tag_); return send_value_; } @@ -87,7 +87,7 @@ } uint32_t QuicFixedUint32::GetReceivedValue() const { - QUIC_BUG_IF(!has_receive_value_) + QUIC_BUG_IF_V2(quic_bug_12743_2, !has_receive_value_) << "No receive value to get for tag:" << QuicTagToString(tag_); return receive_value_; } @@ -99,7 +99,7 @@ void QuicFixedUint32::ToHandshakeMessage(CryptoHandshakeMessage* out) const { if (tag_ == 0) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12743_3) << "This parameter does not support writing to CryptoHandshakeMessage"; return; } @@ -236,7 +236,7 @@ } QuicUint128 QuicFixedUint128::GetSendValue() const { - QUIC_BUG_IF(!has_send_value_) + QUIC_BUG_IF_V2(quic_bug_12743_4, !has_send_value_) << "No send value to get for tag:" << QuicTagToString(tag_); return send_value_; } @@ -251,7 +251,7 @@ } QuicUint128 QuicFixedUint128::GetReceivedValue() const { - QUIC_BUG_IF(!has_receive_value_) + QUIC_BUG_IF_V2(quic_bug_12743_5, !has_receive_value_) << "No receive value to get for tag:" << QuicTagToString(tag_); return receive_value_; } @@ -306,7 +306,7 @@ } const QuicTagVector& QuicFixedTagVector::GetSendValues() const { - QUIC_BUG_IF(!has_send_values_) + QUIC_BUG_IF_V2(quic_bug_12743_6, !has_send_values_) << "No send values to get for tag:" << QuicTagToString(tag_); return send_values_; } @@ -321,7 +321,7 @@ } const QuicTagVector& QuicFixedTagVector::GetReceivedValues() const { - QUIC_BUG_IF(!has_receive_values_) + QUIC_BUG_IF_V2(quic_bug_12743_7, !has_receive_values_) << "No receive value to get for tag:" << QuicTagToString(tag_); return receive_values_; } @@ -377,7 +377,7 @@ } const QuicSocketAddress& QuicFixedSocketAddress::GetSendValue() const { - QUIC_BUG_IF(!has_send_value_) + QUIC_BUG_IF_V2(quic_bug_12743_8, !has_send_value_) << "No send value to get for tag:" << QuicTagToString(tag_); return send_value_; } @@ -392,7 +392,7 @@ } const QuicSocketAddress& QuicFixedSocketAddress::GetReceivedValue() const { - QUIC_BUG_IF(!has_receive_value_) + QUIC_BUG_IF_V2(quic_bug_12743_9, !has_receive_value_) << "No receive value to get for tag:" << QuicTagToString(tag_); return receive_value_; }
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index 271576a..fe7ac45 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -377,7 +377,8 @@ count_bytes_on_alternative_path_separately_ && update_packet_content_returns_connected_ && GetQuicReloadableFlag(quic_server_reverse_validate_new_path)) { - QUIC_BUG_IF(!start_peer_migration_earlier_ && send_path_response_); + QUIC_BUG_IF_V2(quic_bug_12714_1, + !start_peer_migration_earlier_ && send_path_response_); QUICHE_DCHECK(perspective_ == Perspective::IS_CLIENT || default_path_.self_address.IsInitialized()); @@ -399,8 +400,9 @@ << server_connection_id << " and version: " << ParsedQuicVersionToString(version()); - QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(server_connection_id, - transport_version())) + QUIC_BUG_IF_V2(quic_bug_12714_2, + !QuicUtils::IsConnectionIdValidForVersion(server_connection_id, + transport_version())) << "QuicConnection: attempted to use server connection ID " << server_connection_id << " which is invalid with version " << version(); framer_.set_visitor(this); @@ -1300,7 +1302,7 @@ } bool QuicConnection::OnStreamFrame(const QuicStreamFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_3, !connected_) << "Processing STREAM frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1340,7 +1342,7 @@ } bool QuicConnection::OnCryptoFrame(const QuicCryptoFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_4, !connected_) << "Processing CRYPTO frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1360,7 +1362,7 @@ bool QuicConnection::OnAckFrameStart(QuicPacketNumber largest_acked, QuicTime::Delta ack_delay_time) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_5, !connected_) << "Processing ACK frame start when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1408,7 +1410,7 @@ } bool QuicConnection::OnAckRange(QuicPacketNumber start, QuicPacketNumber end) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_6, !connected_) << "Processing ACK frame range when connection is closed. Last frame: " << most_recent_frame_type_; QUIC_DVLOG(1) << ENDPOINT << "OnAckRange: [" << start << ", " << end << ")"; @@ -1443,7 +1445,7 @@ } bool QuicConnection::OnAckFrameEnd(QuicPacketNumber start) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_7, !connected_) << "Processing ACK frame end when connection is closed. Last frame: " << most_recent_frame_type_; QUIC_DVLOG(1) << ENDPOINT << "OnAckFrameEnd, start: " << start; @@ -1504,7 +1506,7 @@ } bool QuicConnection::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_8, !connected_) << "Processing STOP_WAITING frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1542,7 +1544,7 @@ } bool QuicConnection::OnPaddingFrame(const QuicPaddingFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_9, !connected_) << "Processing PADDING frame when connection is closed. Last frame: " << most_recent_frame_type_; if (!UpdatePacketContent(PADDING_FRAME)) { @@ -1556,7 +1558,7 @@ } bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_10, !connected_) << "Processing PING frame when connection is closed. Last frame: " << most_recent_frame_type_; if (!UpdatePacketContent(PING_FRAME)) { @@ -1600,7 +1602,7 @@ } bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_11, !connected_) << "Processing RST_STREAM frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1623,7 +1625,7 @@ } bool QuicConnection::OnStopSendingFrame(const QuicStopSendingFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_12, !connected_) << "Processing STOP_SENDING frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1809,7 +1811,7 @@ } bool QuicConnection::OnMaxStreamsFrame(const QuicMaxStreamsFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_13, !connected_) << "Processing MAX_STREAMS frame when connection is closed. Last frame: " << most_recent_frame_type_; if (!UpdatePacketContent(MAX_STREAMS_FRAME)) { @@ -1839,7 +1841,7 @@ } bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_14, !connected_) << "Processing GOAWAY frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -1960,7 +1962,7 @@ } bool QuicConnection::OnNewTokenFrame(const QuicNewTokenFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_15, !connected_) << "Processing NEW_TOKEN frame when connection is closed. Last frame: " << most_recent_frame_type_; if (!UpdatePacketContent(NEW_TOKEN_FRAME)) { @@ -1985,7 +1987,7 @@ } bool QuicConnection::OnMessageFrame(const QuicMessageFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_16, !connected_) << "Processing MESSAGE frame when connection is closed. Last frame: " << most_recent_frame_type_; @@ -2067,7 +2069,7 @@ } bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) { - QUIC_BUG_IF(!connected_) + QUIC_BUG_IF_V2(quic_bug_12714_17, !connected_) << "Processing BLOCKED frame when connection is closed. Last frame was " << most_recent_frame_type_; @@ -2211,7 +2213,7 @@ // This packet is received on a probing path. Do not close connection. if (IsAlternativePath(last_packet_destination_address_, GetEffectivePeerAddressFromCurrentPacket())) { - QUIC_BUG_IF(alternative_path_.validated) + QUIC_BUG_IF_V2(quic_bug_12714_18, alternative_path_.validated) << "STATELESS_RESET received on alternate path after it's " "validated."; path_validator_.CancelPathValidation(); @@ -2360,9 +2362,9 @@ return; } QUICHE_DCHECK(!legacy_version_encapsulation_in_progress_); - QUIC_BUG_IF(!packet_creator_.CanSetMaxPacketLength()) + QUIC_BUG_IF_V2(quic_bug_12714_19, !packet_creator_.CanSetMaxPacketLength()) << "Cannot activate Legacy Version Encapsulation mid-packet"; - QUIC_BUG_IF(coalesced_packet_.length() != 0u) + QUIC_BUG_IF_V2(quic_bug_12714_20, coalesced_packet_.length() != 0u) << "Cannot activate Legacy Version Encapsulation mid-coalesced-packet"; legacy_version_encapsulation_in_progress_ = true; MaybeUpdatePacketCreatorMaxPacketLengthAndPadding(); @@ -2645,7 +2647,7 @@ << " bytes:" << std::endl << quiche::QuicheTextUtils::HexDump( absl::string_view(packet.data(), packet.length())); - QUIC_BUG_IF(current_packet_data_ != nullptr) + QUIC_BUG_IF_V2(quic_bug_12714_21, current_packet_data_ != nullptr) << "ProcessUdpPacket must not be called while processing a packet."; if (debug_visitor_ != nullptr) { debug_visitor_->OnPacketReceived(self_address, peer_address, packet); @@ -2839,8 +2841,9 @@ peer_issued_cid_manager_ = nullptr; } else { if (peer_issued_cid_manager_ != nullptr) { - QUIC_BUG_IF(!peer_issued_cid_manager_->IsConnectionIdActive( - server_connection_id_)) + QUIC_BUG_IF_V2(quic_bug_12714_22, + !peer_issued_cid_manager_->IsConnectionIdActive( + server_connection_id_)) << "Connection ID replaced header is no longer active. old id: " << server_connection_id_ << " new_id: " << new_server_connection_id; peer_issued_cid_manager_->ReplaceConnectionId(server_connection_id_, @@ -3071,7 +3074,8 @@ QUIC_DVLOG(1) << ENDPOINT << "Bundle an ACK opportunistically"; QuicFrame updated_ack_frame = GetUpdatedAckFrame(); - QUIC_BUG_IF(updated_ack_frame.ack_frame->packets.Empty()) + QUIC_BUG_IF_V2(quic_bug_12714_23, + updated_ack_frame.ack_frame->packets.Empty()) << ENDPOINT << "Attempted to opportunistically bundle an empty " << encryption_level_ << " ACK, " << (has_pending_ack ? "" : "!") << "has_pending_ack, stop_waiting_count_ " << stop_waiting_count_; @@ -3241,7 +3245,8 @@ ++stats_.packets_discarded; return true; case COALESCE: - QUIC_BUG_IF(!version().CanSendCoalescedPackets() || coalescing_done_); + QUIC_BUG_IF_V2(quic_bug_12714_24, + !version().CanSendCoalescedPackets() || coalescing_done_); if (!coalesced_packet_.MaybeCoalescePacket( *packet, self_address(), send_to_address, helper_->GetStreamSendBufferAllocator(), @@ -3463,9 +3468,10 @@ const bool in_flight = sent_packet_manager_.OnPacketSent( packet, packet_send_time, packet->transmission_type, IsRetransmittable(*packet), /*measure_rtt=*/send_on_current_path); - QUIC_BUG_IF(default_enable_5rto_blackhole_detection_ && - blackhole_detector_.IsDetectionInProgress() && - !sent_packet_manager_.HasInFlightPackets()) + QUIC_BUG_IF_V2(quic_bug_12714_25, + default_enable_5rto_blackhole_detection_ && + blackhole_detector_.IsDetectionInProgress() && + !sent_packet_manager_.HasInFlightPackets()) << ENDPOINT << "Trying to start blackhole detection without no bytes in flight"; @@ -3529,7 +3535,7 @@ } if (packet.encryption_level != ENCRYPTION_FORWARD_SECURE) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12714_26) << "MaybeHandleAeadConfidentialityLimits called on non 1-RTT packet"; return false; } @@ -4001,10 +4007,11 @@ // When timer fires in TLP/RTO/PTO mode, ensure 1) at least one packet is // created, or there is data to send and available credit (such that // packets will be sent eventually). - QUIC_BUG_IF(packet_creator_.packet_number() == - previous_created_packet_number && - (!visitor_->WillingAndAbleToWrite() || - sent_packet_manager_.pending_timer_transmission_count() == 0u)) + QUIC_BUG_IF_V2( + quic_bug_12714_27, + packet_creator_.packet_number() == previous_created_packet_number && + (!visitor_->WillingAndAbleToWrite() || + sent_packet_manager_.pending_timer_transmission_count() == 0u)) << "retransmission_mode: " << retransmission_mode << ", packet_number: " << packet_creator_.packet_number() << ", session has data to write: " << visitor_->WillingAndAbleToWrite() @@ -4048,7 +4055,8 @@ } encryption_level_ = level; packet_creator_.set_encryption_level(level); - QUIC_BUG_IF(!framer_.HasEncrypterOfEncryptionLevel(level)) + QUIC_BUG_IF_V2(quic_bug_12714_28, + !framer_.HasEncrypterOfEncryptionLevel(level)) << ENDPOINT << "Trying to set encryption level to " << EncryptionLevelToString(level) << " while the key is missing"; @@ -4465,7 +4473,7 @@ void QuicConnection::SetNetworkTimeouts(QuicTime::Delta handshake_timeout, QuicTime::Delta idle_timeout) { - QUIC_BUG_IF(idle_timeout > handshake_timeout) + QUIC_BUG_IF_V2(quic_bug_12714_29, idle_timeout > handshake_timeout) << "idle_timeout:" << idle_timeout.ToMilliseconds() << " handshake_timeout:" << handshake_timeout.ToMilliseconds(); // Adjust the idle timeout on client and server to prevent clients from @@ -5295,7 +5303,8 @@ // be overridden. QUIC_DVLOG(1) << "The connection hasn't finished handshake or is " "validating a recent peer address change."; - QUIC_BUG_IF(IsHandshakeConfirmed() && !alternative_path_.validated) + QUIC_BUG_IF_V2(quic_bug_12714_30, + IsHandshakeConfirmed() && !alternative_path_.validated) << "No validated peer address to send after handshake comfirmed."; } else if (!IsReceivedPeerAddressValidated()) { // Only override alternative path state upon receiving a PATH_CHALLENGE @@ -5531,7 +5540,8 @@ } if (IsHandshakeComplete()) { // A forward secure packet has been received. - QUIC_BUG_IF(encryption_level_ != ENCRYPTION_FORWARD_SECURE) + QUIC_BUG_IF_V2(quic_bug_12714_31, + encryption_level_ != ENCRYPTION_FORWARD_SECURE) << ENDPOINT << "Unexpected connection close encryption level " << encryption_level_; return ENCRYPTION_FORWARD_SECURE; @@ -5592,7 +5602,7 @@ ack_alarm_->Cancel(); QuicTime earliest_ack_timeout = uber_received_packet_manager_.GetEarliestAckTimeout(); - QUIC_BUG_IF(!earliest_ack_timeout.IsInitialized()); + QUIC_BUG_IF_V2(quic_bug_12714_32, !earliest_ack_timeout.IsInitialized()); MaybeBundleCryptoDataWithAcks(); earliest_ack_timeout = uber_received_packet_manager_.GetEarliestAckTimeout(); if (!earliest_ack_timeout.IsInitialized()) { @@ -5633,7 +5643,8 @@ const bool flushed = packet_creator_.FlushAckFrame(frames); if (!flushed) { // Connection is write blocked. - QUIC_BUG_IF(!writer_->IsWriteBlocked() && !LimitedByAmplificationFactor()) + QUIC_BUG_IF_V2(quic_bug_12714_33, !writer_->IsWriteBlocked() && + !LimitedByAmplificationFactor()) << "Writer not blocked and not throttled by amplification factor, " "but ACK not flushed for packet space:" << i; @@ -5721,7 +5732,7 @@ return false; } if (!version().CanSendCoalescedPackets()) { - QUIC_BUG_IF(coalesced_packet_.length() > 0); + QUIC_BUG_IF_V2(quic_bug_12714_34, coalesced_packet_.length() > 0); return true; } if (coalesced_packet_.ContainsPacketOfEncryptionLevel(ENCRYPTION_INITIAL) && @@ -5849,9 +5860,10 @@ // Stop detections in quiecense. blackhole_detector_.StopDetection(); } - QUIC_BUG_IF(default_enable_5rto_blackhole_detection_ && - blackhole_detector_.IsDetectionInProgress() && - !sent_packet_manager_.HasInFlightPackets()) + QUIC_BUG_IF_V2(quic_bug_12714_35, + default_enable_5rto_blackhole_detection_ && + blackhole_detector_.IsDetectionInProgress() && + !sent_packet_manager_.HasInFlightPackets()) << ENDPOINT << "Trying to start blackhole detection without no bytes in flight"; } @@ -5949,7 +5961,7 @@ void QuicConnection::set_client_connection_id( QuicConnectionId client_connection_id) { if (!version().SupportsClientConnectionIds()) { - QUIC_BUG_IF(!client_connection_id.IsEmpty()) + QUIC_BUG_IF_V2(quic_bug_12714_36, !client_connection_id.IsEmpty()) << ENDPOINT << "Attempted to use client connection ID " << client_connection_id << " with unsupported version " << version(); return;
diff --git a/quic/core/quic_connection_id_manager.cc b/quic/core/quic_connection_id_manager.cc index adf8eba..4aa3c05 100644 --- a/quic/core/quic_connection_id_manager.cc +++ b/quic/core/quic_connection_id_manager.cc
@@ -357,7 +357,7 @@ void QuicSelfIssuedConnectionIdManager::RetireConnectionId() { if (to_be_retired_connection_ids_.empty()) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12420_1) << "retire_connection_id_alarm fired but there is no connection ID " "to be retired."; return;
diff --git a/quic/core/quic_control_frame_manager.cc b/quic/core/quic_control_frame_manager.cc index aedd365..086efa5 100644 --- a/quic/core/quic_control_frame_manager.cc +++ b/quic/core/quic_control_frame_manager.cc
@@ -161,7 +161,7 @@ void QuicControlFrameManager::OnControlFrameSent(const QuicFrame& frame) { QuicControlFrameId id = GetControlFrameId(frame); if (id == kInvalidControlFrameId) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12727_1) << "Send or retransmit a control frame with invalid control frame id"; return; } @@ -225,7 +225,8 @@ } if (!QuicContainsKey(pending_retransmissions_, id)) { pending_retransmissions_[id] = true; - QUIC_BUG_IF(pending_retransmissions_.size() > control_frames_.size()) + QUIC_BUG_IF_V2(quic_bug_12727_2, + pending_retransmissions_.size() > control_frames_.size()) << "least_unacked_: " << least_unacked_ << ", least_unsent_: " << least_unsent_; } @@ -253,7 +254,7 @@ } QuicFrame QuicControlFrameManager::NextPendingRetransmission() const { - QUIC_BUG_IF(pending_retransmissions_.empty()) + QUIC_BUG_IF_V2(quic_bug_12727_3, pending_retransmissions_.empty()) << "Unexpected call to NextPendingRetransmission() with empty pending " << "retransmission list."; QuicControlFrameId id = pending_retransmissions_.begin()->first;
diff --git a/quic/core/quic_crypto_client_handshaker.cc b/quic/core/quic_crypto_client_handshaker.cc index 29a4367..a6ddcca 100644 --- a/quic/core/quic_crypto_client_handshaker.cc +++ b/quic/core/quic_crypto_client_handshaker.cc
@@ -117,14 +117,14 @@ } bool QuicCryptoClientHandshaker::IsResumption() const { - QUIC_BUG_IF(!one_rtt_keys_available_); + QUIC_BUG_IF_V2(quic_bug_12522_1, !one_rtt_keys_available_); // While 0-RTT handshakes could be considered to be like resumption, QUIC // Crypto doesn't have the same notion of a resumption like TLS does. return false; } bool QuicCryptoClientHandshaker::EarlyDataAccepted() const { - QUIC_BUG_IF(!one_rtt_keys_available_); + QUIC_BUG_IF_V2(quic_bug_12522_2, !one_rtt_keys_available_); return num_client_hellos_ == 1; } @@ -133,7 +133,7 @@ } bool QuicCryptoClientHandshaker::ReceivedInchoateReject() const { - QUIC_BUG_IF(!one_rtt_keys_available_); + QUIC_BUG_IF_V2(quic_bug_12522_3, !one_rtt_keys_available_); return num_client_hellos_ >= 3; }
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc index ad5ad11..93e4ca4 100644 --- a/quic/core/quic_crypto_stream.cc +++ b/quic/core/quic_crypto_stream.cc
@@ -71,7 +71,8 @@ } void QuicCryptoStream::OnCryptoFrame(const QuicCryptoFrame& frame) { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_1, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 shouldn't receive CRYPTO frames"; EncryptionLevel level = session()->connection()->last_decrypted_level(); substreams_[level].sequencer.OnCryptoFrame(frame); @@ -85,7 +86,7 @@ void QuicCryptoStream::OnStreamFrame(const QuicStreamFrame& frame) { if (QuicVersionUsesCryptoFrames(session()->transport_version())) { - QUIC_PEER_BUG + QUIC_PEER_BUG_V2(quic_peer_bug_12573_2) << "Crypto data received in stream frame instead of crypto frame"; OnUnrecoverableError(QUIC_INVALID_STREAM_DATA, "Unexpected stream frame"); } @@ -264,7 +265,8 @@ } void QuicCryptoStream::WritePendingCryptoRetransmission() { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_3, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't write CRYPTO frames"; for (EncryptionLevel level : AllEncryptionLevels()) { QuicStreamSendBuffer* send_buffer = &substreams_[level].send_buffer; @@ -382,14 +384,16 @@ QuicStreamOffset offset, QuicByteCount data_length, QuicDataWriter* writer) { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_4, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't write CRYPTO frames (2)"; return substreams_[level].send_buffer.WriteStreamData(offset, data_length, writer); } void QuicCryptoStream::OnCryptoFrameLost(QuicCryptoFrame* crypto_frame) { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_5, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't lose CRYPTO frames"; substreams_[crypto_frame->level].send_buffer.OnStreamDataLost( crypto_frame->offset, crypto_frame->data_length); @@ -397,7 +401,8 @@ void QuicCryptoStream::RetransmitData(QuicCryptoFrame* crypto_frame, TransmissionType type) { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_6, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't retransmit CRYPTO frames"; QuicIntervalSet<QuicStreamOffset> retransmission( crypto_frame->offset, crypto_frame->offset + crypto_frame->data_length); @@ -422,7 +427,8 @@ } void QuicCryptoStream::WriteBufferedCryptoFrames() { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_7, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't use CRYPTO frames"; for (EncryptionLevel level : AllEncryptionLevels()) { QuicStreamSendBuffer* send_buffer = &substreams_[level].send_buffer; @@ -444,7 +450,8 @@ } bool QuicCryptoStream::HasBufferedCryptoFrames() const { - QUIC_BUG_IF(!QuicVersionUsesCryptoFrames(session()->transport_version())) + QUIC_BUG_IF_V2(quic_bug_12573_8, + !QuicVersionUsesCryptoFrames(session()->transport_version())) << "Versions less than 47 don't use CRYPTO frames"; for (EncryptionLevel level : AllEncryptionLevels()) { const QuicStreamSendBuffer& send_buffer = substreams_[level].send_buffer;
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc index 8f37b92..ed2b8eb 100644 --- a/quic/core/quic_dispatcher.cc +++ b/quic/core/quic_dispatcher.cc
@@ -328,7 +328,7 @@ if (use_reference_counted_session_map_) { QUIC_RESTART_FLAG_COUNT(quic_use_reference_counted_sesssion_map); } - QUIC_BUG_IF(GetSupportedVersions().empty()) + QUIC_BUG_IF_V2(quic_bug_12724_1, GetSupportedVersions().empty()) << "Trying to create dispatcher without any supported versions"; QUIC_DLOG(INFO) << "Created QuicDispatcher with versions: " << ParsedQuicVersionVectorToString(GetSupportedVersions()); @@ -916,7 +916,7 @@ if (!write_blocked_list_.empty()) { for (const auto& session : closed_ref_counted_session_list_) { if (write_blocked_list_.erase(session->connection()) != 0) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12724_2) << "QuicConnection was in WriteBlockedList before destruction " << session->connection()->connection_id(); } @@ -927,7 +927,7 @@ if (!write_blocked_list_.empty()) { for (const std::unique_ptr<QuicSession>& session : closed_session_list_) { if (write_blocked_list_.erase(session->connection()) != 0) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12724_3) << "QuicConnection was in WriteBlockedList before destruction " << session->connection()->connection_id(); } @@ -1074,7 +1074,7 @@ if (!blocked_writer->IsWriterBlocked()) { // It is a programming error if this ever happens. When we are sure it is // not happening, replace it with a QUICHE_DCHECK. - QUIC_BUG + QUIC_BUG_V2(quic_bug_12724_4) << "Tried to add writer into blocked list when it shouldn't be added"; // Return without adding the connection to the blocked list, to avoid // infinite loops in OnCanWrite. @@ -1226,7 +1226,7 @@ std::make_pair(server_connection_id, std::shared_ptr<QuicSession>(std::move(session)))); if (!insertion_result.second) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12724_5) << "Tried to add a session to session_map with existing connection " "id: " << server_connection_id; @@ -1237,7 +1237,7 @@ } else { auto insertion_result = session_map_.insert( std::make_pair(server_connection_id, std::move(session))); - QUIC_BUG_IF(!insertion_result.second) + QUIC_BUG_IF_V2(quic_bug_12724_6, !insertion_result.second) << "Tried to add a session to session_map with existing connection " "id: " << server_connection_id; @@ -1302,8 +1302,9 @@ if (GetQuicFlag(FLAGS_quic_allow_chlo_buffering) && new_sessions_allowed_per_event_loop_ <= 0) { // Can't create new session any more. Wait till next event loop. - QUIC_BUG_IF(buffered_packets_.HasChloForConnection( - packet_info->destination_connection_id)); + QUIC_BUG_IF_V2(quic_bug_12724_7, + buffered_packets_.HasChloForConnection( + packet_info->destination_connection_id)); EnqueuePacketResult rs = buffered_packets_.EnqueuePacket( packet_info->destination_connection_id, packet_info->form != GOOGLE_QUIC_PACKET, packet_info->packet, @@ -1357,7 +1358,7 @@ } else { auto insertion_result = session_map_.insert(std::make_pair( packet_info->destination_connection_id, std::move(session))); - QUIC_BUG_IF(!insertion_result.second) + QUIC_BUG_IF_V2(quic_bug_12724_8, !insertion_result.second) << "Tried to add a session to session_map with existing connection id: " << packet_info->destination_connection_id; session_ptr = insertion_result.first->second.get();
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc index 78008d1..cead639 100644 --- a/quic/core/quic_framer.cc +++ b/quic/core/quic_framer.cc
@@ -472,7 +472,7 @@ size_t QuicFramer::GetMessageFrameSize(QuicTransportVersion version, bool last_frame_in_packet, QuicByteCount length) { - QUIC_BUG_IF(!VersionSupportsMessageFrames(version)) + QUIC_BUG_IF_V2(quic_bug_12975_1, !VersionSupportsMessageFrames(version)) << "Try to serialize MESSAGE frame in " << version; return kQuicFrameTypeSize + (last_frame_in_packet ? 0 : QuicDataWriter::GetVarInt62Len(length)) + @@ -895,8 +895,9 @@ char* buffer, size_t packet_length, EncryptionLevel level) { - QUIC_BUG_IF(header.version_flag && version().HasIetfInvariantHeader() && - header.long_packet_type == RETRY && !frames.empty()) + QUIC_BUG_IF_V2(quic_bug_12975_2, + header.version_flag && version().HasIetfInvariantHeader() && + header.long_packet_type == RETRY && !frames.empty()) << "IETF RETRY packets cannot contain frames " << header; QuicDataWriter writer(packet_length, buffer); size_t length_field_offset = 0; @@ -2079,8 +2080,8 @@ bool QuicFramer::IsIetfStatelessResetPacket( const QuicPacketHeader& header) const { - QUIC_BUG_IF(header.has_possible_stateless_reset_token && - perspective_ != Perspective::IS_CLIENT) + QUIC_BUG_IF_V2(quic_bug_12975_3, header.has_possible_stateless_reset_token && + perspective_ != Perspective::IS_CLIENT) << "has_possible_stateless_reset_token can only be true at client side."; return header.form == IETF_QUIC_SHORT_HEADER_PACKET && header.has_possible_stateless_reset_token && @@ -2116,7 +2117,7 @@ EncryptionLevel QuicFramer::GetEncryptionLevelToSendApplicationData() const { if (!HasAnEncrypterForSpace(APPLICATION_DATA)) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12975_4) << "Tried to get encryption level to send application data with no " "encrypter available."; return NUM_ENCRYPTION_LEVELS; @@ -2168,8 +2169,9 @@ } break; case CONNECTION_ID_PRESENT: - QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion( - server_connection_id, transport_version())) + QUIC_BUG_IF_V2(quic_bug_12975_5, + !QuicUtils::IsConnectionIdValidForVersion( + server_connection_id, transport_version())) << "AppendPacketHeader: attempted to use connection ID " << server_connection_id << " which is invalid with version " << version(); @@ -2232,8 +2234,9 @@ QUIC_DVLOG(1) << ENDPOINT << "Appending IETF header: " << header; QuicConnectionId server_connection_id = GetServerConnectionIdAsSender(header, perspective_); - QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(server_connection_id, - transport_version())) + QUIC_BUG_IF_V2(quic_bug_12975_6, + !QuicUtils::IsConnectionIdValidForVersion(server_connection_id, + transport_version())) << "AppendIetfPacketHeader: attempted to use connection ID " << server_connection_id << " which is invalid with version " << version(); if (!AppendIetfHeaderTypeByte(header, writer)) { @@ -2273,7 +2276,8 @@ } // TODO(b/141924462) Remove this QUIC_BUG once we do support sending RETRY. - QUIC_BUG_IF(header.version_flag && header.long_packet_type == RETRY) + QUIC_BUG_IF_V2(quic_bug_12975_7, + header.version_flag && header.long_packet_type == RETRY) << "Sending IETF RETRY packets is not currently supported " << header; if (QuicVersionHasLongHeaderLengths(transport_version()) && @@ -4507,7 +4511,7 @@ } if (encrypter_[level] == nullptr) { - QUIC_BUG + QUIC_BUG_V2(quic_bug_12975_8) << ENDPOINT << "Attempted to apply header protection without encrypter at level " << level << " using " << version_; @@ -5959,7 +5963,7 @@ return false; } if (frame.num_padding_bytes < 0) { - QUIC_BUG_IF(frame.num_padding_bytes != -1); + QUIC_BUG_IF_V2(quic_bug_12975_9, frame.num_padding_bytes != -1); writer->WritePadding(); return true; }