[Bug]: Strange deadlock on start of service process in CoreWCF
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 320
- PR merge metrics
- No merged PRs in 30d
Description
### Duplicate ?
- [x] I have searched issues/discussions and did not find other issues/discussions reporting this bug.
### Product version
1.3.1.1
### Describe expected behavior
Start of process works fine
### Describe actual behavior
Process deadlocks on start.
We observe this only on single instance, can't find any difference with other instances.
Minimal reproducible snippet will try to prepare in week.
But would like to hear maybe something comes to mind about this issue?
### Which binding
NetTcp
### security
Transport
### Which .NET version
.NET Framework
### Which os platform
Windows
### Code snippet used to reproduce the issue
```c#
In progress.
```
### Stacktrace if any
```shell
Thread 2016:
[Deadlocked, double-click or press enter to view all thread stacks]
[Waiting on lock owned by Thread 5220, double-click or press enter to switch to thread]
[Managed to Native Transition]
> Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(System.Guid id, System.Func creator) Unknown
Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(System.Guid primaryId, System.Guid? qualifyingId, System.Func creator) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(Autofac.Core.ISharingLifetimeScope currentOperationScope, Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.ResolutionExtensions.TryResolveService(Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable parameters, out object instance) Unknown
Autofac.dll!Autofac.ResolutionExtensions.ResolveService(Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable parameters) Unknown
Autofac.Extensions.DependencyInjection.dll!Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(System.Type serviceType) Unknown
Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(System.IServiceProvider provider) Unknown
CoreWCF.Primitives.dll!CoreWCF.Description.DispatcherBuilder.BuildDispatcher(CoreWCF.Configuration.ServiceConfiguration serviceConfig, System.IServiceProvider services) Unknown
CoreWCF.Primitives.dll!CoreWCF.Configuration.ServiceConfiguration.GetDispatchers() Unknown
CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.BuildBranch() Unknown
CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.EnsureBranchBuilt() Unknown
CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.BuildBranchAndInvoke(Microsoft.AspNetCore.Http.HttpContext request) Unknown
CoreWCF.Primitives.dll!CoreWCF.Channels.MetadataMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.HostFiltering.dll!Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.HostingApplication.ProcessRequestAsync(Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context context) Unknown
Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests(Microsoft.AspNetCore.Hosting.Server.IHttpApplication application) Unknown
[Resuming Async Method]
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Unknown
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
[Async Call Stack]
[Async] Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync(Microsoft.AspNetCore.Hosting.Server.IHttpApplication application) Unknown
[Async] Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnection.ProcessRequestsAsync(Microsoft.AspNetCore.Hosting.Server.IHttpApplication httpApplication) Unknown
[Async] Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnectionMiddleware.OnConnectionAsync(Microsoft.AspNetCore.Connections.ConnectionContext connectionContext) Unknown
[Async] Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.ConnectionDispatcher.Execute(Microsoft.AspNetCore.Connections.ConnectionContext connectionContext) Unknown
Thread 5220:
[Deadlocked, double-click or press enter to view all thread stacks]
[Waiting on lock owned by Thread 2016, double-click or press enter to switch to thread]
[Managed to Native Transition]
> CoreWCF.Primitives.dll!CoreWCF.Configuration.ServiceConfiguration.GetDispatchers() Unknown
CoreWCF.NetTcp.dll!CoreWCF.Channels.Framing.NetMessageFramingConnectionHandler.BuildAddressTable(System.IServiceProvider services) Unknown
Autofac.dll!Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(Autofac.IComponentContext context, System.Collections.Generic.IEnumerable parameters) Unknown
Autofac.dll!Autofac.Core.Activators.Delegate.DelegateActivator.ConfigurePipeline.AnonymousMethod__2_0(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute.AnonymousMethod__0() Unknown
Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(System.Guid id, System.Func creator) Unknown
Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(System.Guid primaryId, System.Guid? qualifyingId, System.Func creator) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(Autofac.Core.Resolving.Pipeline.ResolveRequestContext context, System.Action next) Unknown
Autofac.dll!Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.BuildPipeline.AnonymousMethod__1(Autofac.Core.Resolving.Pipeline.ResolveRequestContext ctxt) Unknown
Autofac.dll!Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(Autofac.Core.ISharingLifetimeScope currentOperationScope, Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(Autofac.ResolveRequest request) Unknown
Autofac.dll!Autofac.ResolutionExtensions.TryResolveService(Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable parameters, out object instance) Unknown
Autofac.dll!Autofac.ResolutionExtensions.ResolveService(Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable parameters) Unknown
Autofac.Extensions.DependencyInjection.dll!Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(System.Type serviceType) Unknown
Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(System.IServiceProvider provider) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
CoreWCF.Primitives.dll!CoreWCF.Channels.CommunicationObject.OnOpened() Unknown
CoreWCF.Primitives.dll!CoreWCF.Channels.CommunicationObject.OpenAsync(System.Threading.CancellationToken token) Unknown
CoreWCF.Primitives.dll!CoreWCF.Configuration.WrappingIServer.StartAsync(Microsoft.AspNetCore.Hosting.Server.IHttpApplication application, System.Threading.CancellationToken cancellationToken) Unknown
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(System.Threading.CancellationToken cancellationToken) Unknown
UtilsLib.ServiceProcess.dll!UtilsLib.ServiceProcess.WebHostServiceWithDelay.OnStart.AnonymousMethod__6_0() Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Unknown
```
Contributor guide
Assessment
This issue has not been assessed yet.