Skip to content

Instantly share code, notes, and snippets.

View antonfirsov's full-sized avatar

Anton Firszov antonfirsov

View GitHub Profile
<html xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<body>
<h1>Test run details</h1>
<div class="summary">
<div class="block"><span>Total tests</span><div class="total-tests">1182</div><br></div>
<div class="block"><span>Passed : </span><span class="passedTests">1153</span><br><span>Failed : </span><span class="failedTests">9</span><br><span>Skipped : </span><span class="skippedTests">20</span><br></div>
<div class="block"><span>Pass percentage</span><div class="pass-percentage">97 %</div><br></div>
<div class="block"><span>Run duration</span><div class="test-run-time">43s 95ms</div><br></div><br></div>
<h2>Failed Results</h2>
[ConditionalFact(nameof(OsSupportsWinHttpTrailingHeaders))]
public async Task Http2GetAsyncResponseHeadersReadOption_RemoteServer_TrailingHeaders_Available()
{
Uri address = new Uri("https://localhost:5001/trailers.ashx");
using (HttpClient client = CreateHttpClient())
{
Task<HttpResponseMessage> sendTask = client.GetAsync(address, HttpCompletionOption.ResponseHeadersRead);
HttpResponseMessage response = await sendTask;
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
// The workaround is utilizing ConnectCallback, which is a .NET 5+ feature.
// For more info see:
// https://devblogs.microsoft.com/dotnet/net-5-new-networking-improvements/#socketshttphandler-extension-points
public HttpClient CreateHttpClientWithReusePort()
{
SocketsHttpHandler handler = new SocketsHttpHandler
{
ConnectCallback = ReusePortConnectAsync
};
return new HttpClient(handler);
Console log: 'System.Net.Sockets.Tests' from job 93f31455-92dc-4293-9906-96117cc681c8 workitem ce7ce536-f347-49cb-b6f2-f083b0982a70 (osx.1015.amd64.open) executed on machine dci-macpro-09.local
+ ./RunTests.sh --runtime-path /tmp/helix/working/993B086D/p
----- start Thu Jan 21 09:13:50 PST 2021 =============== To repro directly: =====================================================
pushd .
/tmp/helix/working/993B086D/p/dotnet exec --runtimeconfig System.Net.Sockets.Tests.runtimeconfig.json --depsfile System.Net.Sockets.Tests.deps.json xunit.console.dll System.Net.Sockets.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
/private/tmp/helix/working/993B086D/w/B692097E/e /private/tmp/helix/working/993B086D/w/B692097E/e
Discovering: System.Net.Sockets.Tests (method display = ClassAndMethod, method display options = Non
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
namespace HangSockets
{
class Program
{
#include <cstdio>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
internal static class RetryHelper
{
public static async Task ExecuteAsync(Func<Task> test, int maxAttempts = 5, Func<int, int> backoffFunc = null);
}
// Throws custom exceptions, which trigger retries:
internal static class TryAssert
{
public static void Equal(...);
public static void True(...);

Proposed API

I propose to expose a public safe handle type with methods to set and query custom options. These methods would be a direct wrappers around WinHttpSetOption and WinHttpQueryOption, similarly to the concept of Socket.SetRawSocketOption.

public class SafeWinHttpHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
    public uint GetWinHttpOption(uint option); 
 public void SetWinHttpOption(uint option, uint optionData);
go to runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress
run
1. Linux: ./run-docker-compose.sh -b -clientstressargs "-maxExecutionTime 720"
2. Windows: .\run-docker-compose.ps1 -b -w -clientstressargs "-maxExecutionTime 720"
run again for HTTP/1.1
1. Linux: ./run-docker-compose.sh -b -clientstressargs "-maxExecutionTime 720 -http 1.1"
2. Windows: .\run-docker-compose.ps1 -b -w -clientstressargs "-maxExecutionTime 720 -http 1.1"
sudo apt-get install clang-9
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install build-essential
sudo apt-get install python
sudo apt-get install curl
sudo apt-get install git
sudo apt-get install lldb-6.0
sudo apt-get install liblldb-6.0-dev