Skip to content

Commit 1951ddf

Browse files
authored
Improve reliability of MaxRequestBufferSizeTests.LargeUpload (#2586)
- Increase _dataLength from 20MB to 40MB to improve test reliability when using Sockets transport on Windows - Addresses aspnet/KestrelHttpServer#2225
1 parent 43cabfd commit 1951ddf

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

test/Kestrel.FunctionalTests/MaxRequestBufferSizeTests.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,32 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
2121
{
2222
public class MaxRequestBufferSizeTests : LoggedTest
2323
{
24-
private const int _dataLength = 20 * 1024 * 1024;
24+
// The client is typically paused after uploading this many bytes:
25+
//
26+
// OS MaxRequestBufferSize (MB) connectionAdapter Transport min pause (MB) max pause (MB)
27+
// --------------- ------------------------- ----------------- --------- -------------- --------------
28+
// Windows 10 1803 1 false Libuv 1.7 3.3
29+
// Windows 10 1803 1 false Sockets 1.7 4.4
30+
// Windows 10 1803 1 true Libuv 3.0 8.4
31+
// Windows 10 1803 1 true Sockets 3.2 9.0
32+
//
33+
// Windows 10 1803 5 false Libuv 6 13
34+
// Windows 10 1803 5 false Sockets 7 24
35+
// Windows 10 1803 5 true Libuv 12 12
36+
// Windows 10 1803 5 true Sockets 12 36
37+
// Ubuntu 18.04 5 false Libuv 13 15
38+
// Ubuntu 18.04 5 false Sockets 13 15
39+
// Ubuntu 18.04 5 true Libuv 19 20
40+
// Ubuntu 18.04 5 true Sockets 18 20
41+
// macOS 10.13.4 5 false Libuv 6 6
42+
// macOS 10.13.4 5 false Sockets 6 6
43+
// macOS 10.13.4 5 true Libuv 11 11
44+
// macOS 10.13.4 5 true Sockets 11 11
45+
//
46+
// When connectionAdapter=true, the MaxRequestBufferSize is set on two pipes, so it's effectively doubled.
47+
//
48+
// To ensure reliability, _dataLength must be greater than the largest "max pause" in any configuration
49+
private const int _dataLength = 40 * 1024 * 1024;
2550

2651
private static readonly string[] _requestLines = new[]
2752
{
@@ -47,8 +72,6 @@ public static IEnumerable<object[]> LargeUploadData
4772
Tuple.Create((long?)1024 * 1024, true),
4873

4974
// Larger than default, but still significantly lower than data, so client should be paused.
50-
// On Windows, the client is usually paused around (MaxRequestBufferSize + 700,000).
51-
// On Linux, the client is usually paused around (MaxRequestBufferSize + 10,000,000).
5275
Tuple.Create((long?)5 * 1024 * 1024, true),
5376

5477
// Even though maxRequestBufferSize < _dataLength, client should not be paused since the
@@ -286,6 +309,8 @@ private IWebHost StartWebHost(long? maxRequestBufferSize,
286309
}
287310

288311
options.Limits.MinRequestBodyDataRate = null;
312+
313+
options.Limits.MaxRequestBodySize = _dataLength;
289314
})
290315
.UseContentRoot(Directory.GetCurrentDirectory())
291316
.Configure(app => app.Run(async context =>

0 commit comments

Comments
 (0)