1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

QUIC Client 0-RTT With Retry Token Fix

Summary:
## Issue
When we enabled the JK to set QUIC server's rate limit to zero (D30703498), causing it to send retry packets to all incoming client hellos, we found that android clients were crashing (T99705615).

We were able to reproduce the bug with LigerIntegrationTest and HQClient backed by HQServer, causing the clients to hang.

## Fix
- When receiving a retry packet from the server, migrate the outstandings, stream manager, among other required fields to the new connection state.

- QuicStreamManager & QuicStreamState constructors to facilitate migrating to a new connection state.

Reviewed By: kvtsoy

Differential Revision: D31006905

fbshipit-source-id: 0490ceee1bef52b94c91019426d791e212820508
This commit is contained in:
Hani Damlaj
2021-09-23 12:33:06 -07:00
committed by Facebook GitHub Bot
parent acd9116f0f
commit a38a1c7977
5 changed files with 231 additions and 5 deletions

View File

@@ -7,6 +7,8 @@
*/
#include <quic/client/state/ClientStateMachine.h>
#include <quic/codec/Types.h>
#include <quic/loss/QuicLossFunctions.h>
#include <folly/io/async/AsyncSocketException.h>
#include <quic/client/handshake/CachedServerTransportParameters.h>
@@ -57,6 +59,7 @@ std::unique_ptr<QuicClientConnectionState> undoAllClientStateForRetry(
std::move(conn->earlyDataAppParamsValidator);
newConn->earlyDataAppParamsGetter = std::move(conn->earlyDataAppParamsGetter);
newConn->happyEyeballsState = std::move(conn->happyEyeballsState);
newConn->flowControlState = std::move(conn->flowControlState);
newConn->pendingOneRttData.reserve(
newConn->transportSettings.maxPacketsToBuffer);
if (conn->congestionControllerFactory) {
@@ -69,6 +72,27 @@ std::unique_ptr<QuicClientConnectionState> undoAllClientStateForRetry(
*newConn, conn->congestionController->type());
}
}
// only copy over zero-rtt data
for (auto& outstandingPacket : conn->outstandings.packets) {
auto& packetHeader = outstandingPacket.packet.header;
if (packetHeader.getPacketNumberSpace() == PacketNumberSpace::AppData &&
packetHeader.getProtectionType() == ProtectionType::ZeroRtt) {
newConn->outstandings.packets.push_back(std::move(outstandingPacket));
newConn->outstandings.packetCount[PacketNumberSpace::AppData]++;
}
}
newConn->lossState = conn->lossState;
newConn->nodeType = conn->nodeType;
newConn->streamManager = std::make_unique<QuicStreamManager>(
*newConn,
newConn->nodeType,
newConn->transportSettings,
std::move(*conn->streamManager));
markZeroRttPacketsLost(*newConn, markPacketLoss);
return newConn;
}