Skip to content

Instantly share code, notes, and snippets.

View antonfirsov's full-sized avatar

Anton Firszov antonfirsov

View GitHub Profile
public class _ExhaustTest : IDisposable
{
public const int ListenerCount = 1000;
public const int ConnectCount = 1024 * 20;
//public const int ConnectCount = 10;
private readonly ITestOutputHelper _output;
private Task[] _listenTasks = new Task[ListenerCount];
private Socket[] _listeners = new Socket[ListenerCount];
@antonfirsov
antonfirsov / Type1.txt
Created March 22, 2021 15:34
HTTP Stress failures
2021-03-18T15:01:04.4504783Z client_1 | System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (server:5001)
2021-03-18T15:01:04.4506315Z
2021-03-18T15:01:04.4508672Z client_1 | ---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
2021-03-18T15:01:04.4509920Z
2021-03-18T15:01:04.4511533Z client_1 | at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs:line 1233
2021-03-18T15:01:04.4512995Z
2021-03-18T15:01:04.4514290Z client_1 | at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.
@antonfirsov
antonfirsov / Backend Utility Class.cs
Created March 18, 2021 14:51
ImageSharp-1577-Repro
public static void TransformImage(ImageEditModel imageEdit, MemoryStream destinationStream)
{
if (destinationStream == null)
{
throw new ArgumentNullException(nameof(destinationStream));
}
var sourceImage = Image.Load(imageEdit.SourceStream);
var blur = imageEdit.History.Where(h => h.Tool == ImageTool.Blur).FirstOrDefault();
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Drawing.Processing;
using System;
using SixLabors.ImageSharp.PixelFormats;
namespace ColonTest
{
class Program
<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>