Add a GFE_BUG that logs pending frames to write and current/previous frame types in read.
PiperOrigin-RevId: 388439023
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index bbdaf9b..02a903b 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -5339,6 +5339,15 @@
<< "EffectivePeerMigration started without address change.";
return;
}
+ if (packet_creator_.HasPendingFrames()) {
+ QUIC_BUG(bug_731_2)
+ << "Starts effective peer migration with pending frame types: "
+ << packet_creator_.GetPendingFramesInfo() << ". Address change type is "
+ << AddressChangeTypeToString(type)
+ << ". Current frame type: " << framer_.current_received_frame_type()
+ << ". Previous frame type: "
+ << framer_.previously_received_frame_type();
+ }
// Action items:
// 1. Switch congestion controller;
@@ -5396,6 +5405,15 @@
}
// Update to the new peer address.
+ if (packet_creator_.HasPendingFrames()) {
+ QUIC_BUG(bug_731_1)
+ << "Starts effective peer migration with pending frame types: "
+ << packet_creator_.GetPendingFramesInfo() << ". Address change type is "
+ << AddressChangeTypeToString(type)
+ << ". Current frame type: " << framer_.current_received_frame_type()
+ << ". Previous frame type: "
+ << framer_.previously_received_frame_type();
+ }
UpdatePeerAddress(last_received_packet_info_.source_address);
// Update the default path.
if (IsAlternativePath(last_received_packet_info_.destination_address,
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index bc10b50..24b2be8 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -398,8 +398,7 @@
} // namespace
QuicFramer::QuicFramer(const ParsedQuicVersionVector& supported_versions,
- QuicTime creation_time,
- Perspective perspective,
+ QuicTime creation_time, Perspective perspective,
uint8_t expected_server_connection_id_length)
: visitor_(nullptr),
error_(QUIC_NO_ERROR),
@@ -429,7 +428,8 @@
last_written_packet_number_length_(0),
peer_ack_delay_exponent_(kDefaultAckDelayExponent),
local_ack_delay_exponent_(kDefaultAckDelayExponent),
- current_received_frame_type_(0) {
+ current_received_frame_type_(0),
+ previously_received_frame_type_(0) {
QUICHE_DCHECK(!supported_versions.empty());
version_ = supported_versions_[0];
QUICHE_DCHECK(version_.IsKnown())
@@ -1964,8 +1964,10 @@
// Handle the payload.
if (VersionHasIetfQuicFrames(version_.transport_version)) {
current_received_frame_type_ = 0;
+ previously_received_frame_type_ = 0;
if (!ProcessIetfFrameData(&reader, *header, decrypted_level)) {
current_received_frame_type_ = 0;
+ previously_received_frame_type_ = 0;
QUICHE_DCHECK_NE(QUIC_NO_ERROR,
error_); // ProcessIetfFrameData sets the error.
QUICHE_DCHECK_NE("", detailed_error_);
@@ -1974,6 +1976,7 @@
return false;
}
current_received_frame_type_ = 0;
+ previously_received_frame_type_ = 0;
} else {
if (!ProcessFrameData(&reader, *header)) {
QUICHE_DCHECK_NE(QUIC_NO_ERROR,
@@ -3215,6 +3218,7 @@
EncryptionLevelToString(decrypted_level)));
return RaiseError(IETF_QUIC_PROTOCOL_VIOLATION);
}
+ previously_received_frame_type_ = current_received_frame_type_;
current_received_frame_type_ = frame_type;
// Is now the number of bytes into which the frame type was encoded.
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h
index 2920db3..31cc756 100644
--- a/quic/core/quic_framer.h
+++ b/quic/core/quic_framer.h
@@ -650,6 +650,10 @@
return current_received_frame_type_;
}
+ uint64_t previously_received_frame_type() const {
+ return previously_received_frame_type_;
+ }
+
// The connection ID length the framer expects on incoming IETF short headers
// on the server.
uint8_t GetExpectedServerConnectionIdLength() {
@@ -1190,6 +1194,11 @@
// the Transport Connection Close when there is an error during frame
// processing.
uint64_t current_received_frame_type_;
+
+ // TODO(haoyuewang) Remove this debug utility.
+ // The type of the IETF frame preceding the frame currently being processed. 0
+ // when not processing a frame or only 1 frame has been processed.
+ uint64_t previously_received_frame_type_;
};
// Look for and parse the error code from the "<quic_error_code>:" text that
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 3be1067..94cf48a 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -697,6 +697,10 @@
return !queued_frames_.empty();
}
+std::string QuicPacketCreator::GetPendingFramesInfo() const {
+ return QuicFramesToString(queued_frames_);
+}
+
bool QuicPacketCreator::HasPendingRetransmittableFrames() const {
return !packet_.retransmittable_frames.empty();
}
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index abf24f6..9cc4bca 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -205,6 +205,10 @@
// Returns true if there are frames pending to be serialized.
bool HasPendingFrames() const;
+ // TODO(haoyuewang) Remove this debug utility.
+ // Returns the information of pending frames as a string.
+ std::string GetPendingFramesInfo() const;
+
// Returns true if there are retransmittable frames pending to be serialized.
bool HasPendingRetransmittableFrames() const;
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index a4e7a0a..3dc1a4b 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -423,6 +423,8 @@
EXPECT_EQ(0u, consumed);
CheckStreamFrame(frame, stream_id, std::string(), 0u, true);
EXPECT_TRUE(creator_.HasPendingFrames());
+ EXPECT_TRUE(absl::StartsWith(creator_.GetPendingFramesInfo(),
+ "type { STREAM_FRAME }"));
}
TEST_P(QuicPacketCreatorTest, CreateAllFreeBytesForStreamFrames) {