Loading src/quic.cpp +34 −12 Changes for src/quic.cpp: 34 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -2444,18 +2444,40 @@ void quic::connect(const std::string& addr, int port, bool nonblock) { // Delegate address resolution, socket creation and UDP connect to the base class udp::connect(addr, port, nonblock); // NOTE: enlarging SO_RCVBUF/SO_SNDBUF here (matching the server ctors' // 4MB) was tried and reverted — bisection showed it reproducibly breaks // quic_roundtrip_sha256_test (hangs/aborts on the very first round, // where the pre-change baseline passes cleanly). SO_RCVBUF alone is // enough to trigger it, independent of SO_SNDBUF, GSO/GRO, or any of // the other changes in this diff (each ruled out individually via // bisection). The setsockopt calls themselves report success with the // expected doubled kernel buffer size, so this isn't a syscall failure // — something about the larger client receive queue interacts badly // with a downstream path (client-side batch pump is the prime // remaining suspect, but not confirmed). Left as probeGSOGRO() only, // which bisected clean on its own. // Enlarge the receive/send buffers to match the server ctors' 4MB (see // their comment) — without this, the client sits at the OS default // (~208KB on Linux) while cwnd's slow start grows unbounded until a // burst overflows it, causing genuine kernel-level datagram drops // (confirmed via /proc/net/snmp's Udp RcvbufErrors counter: tens of // thousands in a single multi-MB transfer) that repeatedly collapse // cwnd right back down. // // This was tried once before and reverted: it reproducibly hung // quic_roundtrip_sha256_test. That was never actually caused by the // larger buffer itself — it was a pre-existing bug the larger buffer // exposed by removing the packet loss that had been accidentally // masking it. _app_ack_pending (and its Initial/Handshake-level // equivalents) used to be set for every successfully-decrypted packet, // regardless of what it contained — violating RFC 9000 §13.2.1 ("a // packet containing only ACK frames does not elicit an ACK"). An ACK // sent for real data triggered an ACK-of-the-ACK, which triggered // another, forever. With the small buffer, that infinite exchange // eventually dropped a packet and broke the cycle; with a correctly // sized buffer, nothing dropped it, so it livelocked. Now fixed at the // source (processFrame()'s ack_eliciting out-param), so the buffer // increase is safe to re-apply. int rcvbuf = 4 * 1024 * 1024; int sndbuf = 4 * 1024 * 1024; #ifdef _WIN32 const char* rcvopt = reinterpret_cast<const char*>(&rcvbuf); const char* sndopt = reinterpret_cast<const char*>(&sndbuf); #else int* rcvopt = &rcvbuf; int* sndopt = &sndbuf; #endif ::setsockopt(_Socket, SOL_SOCKET, SO_RCVBUF, rcvopt, sizeof(rcvbuf)); ::setsockopt(_Socket, SOL_SOCKET, SO_SNDBUF, sndopt, sizeof(sndbuf)); probeGSOGRO(); // Generate random DCID for the server (we don't know their CID yet) Loading Loading
src/quic.cpp +34 −12 Changes for src/quic.cpp: 34 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -2444,18 +2444,40 @@ void quic::connect(const std::string& addr, int port, bool nonblock) { // Delegate address resolution, socket creation and UDP connect to the base class udp::connect(addr, port, nonblock); // NOTE: enlarging SO_RCVBUF/SO_SNDBUF here (matching the server ctors' // 4MB) was tried and reverted — bisection showed it reproducibly breaks // quic_roundtrip_sha256_test (hangs/aborts on the very first round, // where the pre-change baseline passes cleanly). SO_RCVBUF alone is // enough to trigger it, independent of SO_SNDBUF, GSO/GRO, or any of // the other changes in this diff (each ruled out individually via // bisection). The setsockopt calls themselves report success with the // expected doubled kernel buffer size, so this isn't a syscall failure // — something about the larger client receive queue interacts badly // with a downstream path (client-side batch pump is the prime // remaining suspect, but not confirmed). Left as probeGSOGRO() only, // which bisected clean on its own. // Enlarge the receive/send buffers to match the server ctors' 4MB (see // their comment) — without this, the client sits at the OS default // (~208KB on Linux) while cwnd's slow start grows unbounded until a // burst overflows it, causing genuine kernel-level datagram drops // (confirmed via /proc/net/snmp's Udp RcvbufErrors counter: tens of // thousands in a single multi-MB transfer) that repeatedly collapse // cwnd right back down. // // This was tried once before and reverted: it reproducibly hung // quic_roundtrip_sha256_test. That was never actually caused by the // larger buffer itself — it was a pre-existing bug the larger buffer // exposed by removing the packet loss that had been accidentally // masking it. _app_ack_pending (and its Initial/Handshake-level // equivalents) used to be set for every successfully-decrypted packet, // regardless of what it contained — violating RFC 9000 §13.2.1 ("a // packet containing only ACK frames does not elicit an ACK"). An ACK // sent for real data triggered an ACK-of-the-ACK, which triggered // another, forever. With the small buffer, that infinite exchange // eventually dropped a packet and broke the cycle; with a correctly // sized buffer, nothing dropped it, so it livelocked. Now fixed at the // source (processFrame()'s ack_eliciting out-param), so the buffer // increase is safe to re-apply. int rcvbuf = 4 * 1024 * 1024; int sndbuf = 4 * 1024 * 1024; #ifdef _WIN32 const char* rcvopt = reinterpret_cast<const char*>(&rcvbuf); const char* sndopt = reinterpret_cast<const char*>(&sndbuf); #else int* rcvopt = &rcvbuf; int* sndopt = &sndbuf; #endif ::setsockopt(_Socket, SOL_SOCKET, SO_RCVBUF, rcvopt, sizeof(rcvbuf)); ::setsockopt(_Socket, SOL_SOCKET, SO_SNDBUF, sndopt, sizeof(sndbuf)); probeGSOGRO(); // Generate random DCID for the server (we don't know their CID yet) Loading