Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server no respond to multiple domains #29738

Closed
arcemero opened this issue Jan 28, 2021 · 5 comments
Closed

Server no respond to multiple domains #29738

arcemero opened this issue Jan 28, 2021 · 5 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@arcemero
Copy link

Introduction
I am working on a platform where new sites can be registered, for example, like CPanel where new domains are added to the hosting, in the past I worked with Apache where it added new vhosts, restarted the environment and could accept new requests. But for control reasons and that my systems are in .NET I am migrating the services to NET Core 5 replacing Apache Http Server

Requirements
I need that from a control panel the user can direct the dns of his domain to the ip of the server that runs netcore, and netcore must process the request

Listeners
For the purpose, I use "ListenAnyIP" to wait for https and http requests.
With the https protocol, "ServerCertificateSelector" was used to load the certificates dynamically when receiving the request for a new domain.

`

Host.CreateDefaultBuilder()

.ConfigureWebHostDefaults(host => host

.UseKestrel(options =>

{

    options.AllowSynchronousIO = true;

    options.ListenAnyIP(int.Parse(System.Environment.GetEnvironmentVariable("HTTP")));

    options.ListenAnyIP(int.Parse(System.Environment.GetEnvironmentVariable("HTTPS")), chanel =>

     {

         chanel.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2;

         chanel.UseHttps(

             https  => https.ServerCertificateSelector = (context, name) 

                    => Pipeline.AcquireDomain(name ?? context.RemoteEndPoint.ToString()).X509Cert);

     });

})

.UseStartup<Engine>())

.Build()

.Run();

`

issue
At some point that I still do not identify how to replicate the problem, web requests for new domains are not processed. It does not generate any type of log, or alert ... nothing. Only after a few minutes does it return a "time out" in the browser. as if there was no server listening for requests but the domains that were registered work correctly.
When I restart the server and immediately start to enter the sites, they are processed correctly and continue to function, but randomly stops receiving requests for domains that are registered later.

technical details
-------------------------------------------------------------- visual studio
Microsoft Visual Studio Community 2019
Versión 16.8.2
VisualStudio.16.Release/16.8.2+30717.126
Microsoft .NET Framework
Versión 4.8.04084

Versión instalada: Community

Visual C++ 2019 00435-60000-00000-AA637
Microsoft Visual C++ 2019

Administrador de paquetes NuGet 5.8.0
Administrador de paquetes NuGet de Visual Studio. Para obtener más información acerca de NuGet, visite https://docs.nuget.org/

Asistentes de Microsoft Visual C++ 1.0
Asistentes de Microsoft Visual C++

ASP.NET and Web Tools 2019 16.8.553.28003
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019 16.8.553.28003
Para obtener más información, visite https://www.asp.net/

Azure Functions and Web Jobs Tools 16.8.553.28003
Azure Functions and Web Jobs Tools

Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Extensión IntelliCode 1.0
Información detallada de la extensión Visual Studio IntelliCode

Herramientas comunes de Windows Azure 1.10
Ofrece servicios comunes para su uso con los servicios móviles de Microsoft Azure y Microsoft Azure Tools.

Herramientas de Azure App Service v3.0.0 16.8.553.28003
Herramientas de Azure App Service v3.0.0

Herramientas de C# 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
Los componentes de C# utilizados en el IDE. En función del tipo de proyecto y la configuración, se podría utilizar una versión diferente del compilador.

Herramientas de entrega continua de Microsoft para Visual Studio 0.4
Configuración simplificada de las canalizaciones de Azure DevOps desde el IDE de Visual Studio.

Herramientas de TypeScript 16.0.21016.2001
Herramientas de TypeScript para Microsoft Visual Studio

Herramientas de Visual Basic 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
Los componentes de Visual Basic utilizados en el IDE. En función del tipo de proyecto y la configuración, se podría utilizar una versión diferente del compilador.

Herramientas de Visual F# 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Herramientas de Microsoft Visual F#

Microsoft Azure Tools 2.9
Microsoft Azure Tools para Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools para contenedores 1.1
Desarrolle, ejecute y valide sus aplicaciones de ASP.NET Core en el entorno de destino. Presione F5 para ejecutar la aplicación directamente en un contenedor con opción de depuración, o bien presione CTRL + F5 para editar y actualizar la aplicación sin necesidad de recompilar el contenedor.

Mono Debugging for Visual Studio 16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.

Paquete del host de adaptador de depuración de Visual Studio Code 1.0
Capa de interoperabilidad para el hospedaje de adaptadores de depuración de Visual Studio Code en Visual Studio

Paquete VC de Microsoft Visual Studio 1.0
Paquete VC de Microsoft Visual Studio

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.62010.06180
Microsoft SQL Server Data Tools

Visual C++ for Linux Development 1.0.9.30608
Visual C++ for Linux Development

Visual Studio Container Tools Extensions 1.0
Vea, administre y diagnostique contenedores en Visual Studio.

Visual Studio Tools para CMake 1.0
Visual Studio Tools para CMake

Visual Studio Tools para contenedores 1.0
Visual Studio Tools para contenedores

VisualStudio.DeviceLog 1.0
Información sobre el paquete

VisualStudio.Foo 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.8.000.255 (d16-8@d002176)
Extensión de Visual Studio para habilitar la implementación de Xamarin.iOS y Xamarin.Android.

Xamarin Designer 16.8.0.507 (remotes/origin/d16-8@e87b24884)
Extensión de Visual Studio para habilitar las herramientas de Xamarin Designer en Visual Studio.

Xamarin Templates 16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 11.1.0.17 (d16-8/c0e2b8e)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: be2226b
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard@ebe9000
SQLite: xamarin/sqlite@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

Xamarin.iOS and Xamarin.Mac SDK 14.4.1.3 (e30c41de3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

-------------------------------------------------------------- dotnet --info
SDK de .NET (que refleje cualquier global.json):
Version: 5.0.100
Commit: 5044b93829

Entorno de tiempo de ejecución:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7

.NET SDKs installed:
2.2.100 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@Tratcher
Copy link
Member

Are you able to capture a dump of the server process when it's in this state? Check for any blocked threads.

@Tratcher Tratcher added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 29, 2021
@arcemero
Copy link
Author

Are you able to capture a dump of the server process when it's in this state? Check for any blocked threads.

When testing in different environments, I found that for some reason it only occurs in a Docker container with Debian "image: debian: buster-slim" of 1 cpu and 250mb in ram on a Debian 10 server.
If I assign more CPU to the container, the problem does not occur.

I'm thinking it's because of the container capacity and not netcore.

I will carry out more tests to see if I can replicate the problem in an environment prepared for production
All the tests that I have carried out with more than 1 CPU have been satisfactory, without problems.

It should be noted that the problem does not occur in Windows desktop Docker although the container only has 1 cpu, it only happens with Docker on a Debian 10 host, I do not know if it happens with other Linux distros

I think it is not a critical problem given these conditions.

I am going to review in detail the threads that are generated since there are several operations and I have to perform the complete trace to find the affected thread and I do not know if it exists because I believe that the request is blocked by the same docker due to the low resources of the container, I am not an expert in docker so it is pure inference

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 29, 2021
@Tratcher
Copy link
Member

Possibly related: #21183 @davidfowl

@davidfowl
Copy link
Member

Yes it might be due to the logic in the custom certificate selector or something else causing starvation (I see AllowSynchronousIo is on)

@Tratcher Tratcher added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Jan 29, 2021
@ghost
Copy link

ghost commented Feb 2, 2021

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Feb 5, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 7, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

5 participants