[PATCH] Tests: optimized processing of large QUIC packets with padding

Maxim Dounin mdounin at mdounin.ru
Mon Jun 3 02:24:16 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1717377448 -10800
#      Mon Jun 03 04:17:28 2024 +0300
# Node ID c7315caf211007b327886fe7cd544be018c0a398
# Parent  fb25cbe9d4ec378e7a98ac83d20a82a7e5a835da
Tests: optimized processing of large QUIC packets with padding.

Path MTU discovery packets might contain a lot of padding, and creating
a copy of the whole buffer for each PADDING frame, which is just one
byte with type 0, consumes lots of resources.  This was seen to result
in flapping of at least h3_keepalive.t and h3_ssl_early_data.t tests.

Fix is to copy at most 8 bytes for parse_int() calls when parsing
frame types.

diff --git a/lib/Test/Nginx/HTTP3.pm b/lib/Test/Nginx/HTTP3.pm
--- a/lib/Test/Nginx/HTTP3.pm
+++ b/lib/Test/Nginx/HTTP3.pm
@@ -1361,7 +1361,7 @@ sub parse_frames {
 	my $offset = 0;
 
 	while ($offset < length($buf)) {
-		my ($tlen, $type) = parse_int(substr($buf, $offset));
+		my ($tlen, $type) = parse_int(substr($buf, $offset, 8));
 		$offset += $tlen;
 		next if $type == 0;
 		my $frame = { type => $type };




More information about the nginx-devel mailing list