In quic, return from quiccryptostream::writependingcryptoretransmission after partial writes. protected by gfe2_reloadable_flag_quic_fix_write_pending_crypto_retransmission. Also add more logging when failed to serialize packet. PiperOrigin-RevId: 311754483 Change-Id: I928ef099e00a6029386440339704cd15f9d1db22
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc index 20704fb..59a0122 100644 --- a/quic/core/quic_crypto_stream.cc +++ b/quic/core/quic_crypto_stream.cc
@@ -268,6 +268,12 @@ level, pending.length, pending.offset, HANDSHAKE_RETRANSMISSION); send_buffer->OnStreamDataRetransmitted(pending.offset, bytes_consumed); if (bytes_consumed < pending.length) { + if (GetQuicReloadableFlag( + quic_fix_write_pending_crypto_retransmission)) { + QUIC_RELOADABLE_FLAG_COUNT( + quic_fix_write_pending_crypto_retransmission); + return; + } break; } }
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc index 0ae78d2..d5555fc 100644 --- a/quic/core/quic_packet_creator.cc +++ b/quic/core/quic_packet_creator.cc
@@ -722,7 +722,12 @@ framer_->BuildDataPacket(header, queued_frames_, encrypted_buffer, packet_size_, packet_.encryption_level); if (length == 0) { - QUIC_BUG << "Failed to serialize " << queued_frames_.size() << " frames."; + QUIC_BUG << "Failed to serialize " << QuicFramesToString(queued_frames_) + << " at encryption_level: " + << EncryptionLevelToString(packet_.encryption_level) + << ", needs_full_padding_: " << needs_full_padding_ + << ", packet_.num_padding_bytes: " << packet_.num_padding_bytes + << ", pending_padding_bytes_: " << pending_padding_bytes_; return; } @@ -1291,7 +1296,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 << "Failed to ConsumeCryptoData at level " + << EncryptionLevelToString(level); return 0; } total_bytes_consumed += frame.crypto_frame->data_length;