none
.Net Application Hanging, unable to restart, or kill process RRS feed

  • Question

  • An application that was recently developed is encountering a weird behavior where all but a single thread stops when an app pool recycle is requested.  The last thread, the one that does not obey the stop application pool request, seems to be hung.  I am unable to kill the process from task manager, powershell, or command prompt. Every time it results with "The operation could not be completed. Access is denied."

    I have three different memory dumps of this issue available. All three show the same thread stack hung (included below).

    Not sure what the best course of action is here with this issue, hoping someone out there can help. Not sure if this is the correct forum, please advise if I am in the wrong area.

    Thanks,

    Skyler

    > ntdll.dll!NtClose()
      mswsock.dll!SockCloseSocket()
      mswsock.dll!WSPCloseSocket()
      ws2_32.dll!closesocket()
      System.Data.dll!Tcp::FCloseRefHandle(void)
      System.Data.dll!Tcp::Close(void)
      System.Data.dll!Smux::Close(void)
      System.Data.dll!SNIClose()
      [Managed to Native Transition]
      System.Data.dll!SNINativeMethodWrapper.SNIClose(System.IntPtr pConn)
      System.Data.dll!System.Data.SqlClient.SNIHandle.ReleaseHandle()
      [Native to Managed Transition]
      [Managed to Native Transition]
      mscorlib.dll!System.Runtime.InteropServices.SafeHandle.Dispose(bool disposing)
      mscorlib.dll!System.Runtime.InteropServices.SafeHandle.Dispose()
      System.Data.dll!System.Data.SqlClient.TdsParserStateObject.Dispose()
      System.Data.dll!System.Data.SqlClient.TdsParser.Disconnect()
      System.Data.dll!System.Data.SqlClient.SqlInternalConnectionTds.Dispose()
      System.Data.dll!System.Data.ProviderBase.DbConnectionPool.DestroyObject(System.Data.ProviderBase.DbConnectionInternal obj)
      System.Data.dll!System.Data.ProviderBase.DbConnectionPool.DeactivateObject(System.Data.ProviderBase.DbConnectionInternal obj)
      System.Data.dll!System.Data.ProviderBase.DbConnectionPool.PutObject(System.Data.ProviderBase.DbConnectionInternal obj, object owningObject)
      System.Data.dll!System.Data.ProviderBase.DbConnectionInternal.CloseConnection(System.Data.Common.DbConnection owningObject, System.Data.ProviderBase.DbConnectionFactory connectionFactory)
      System.Data.dll!System.Data.SqlClient.SqlConnection.Close()
      System.Data.dll!System.Data.SqlClient.SqlConnection.Dispose(bool disposing)
      System.dll!System.ComponentModel.Component.Dispose()
      EntityFramework.dll!System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Dispose.AnonymousMethod__c(System.Data.Common.DbConnection t, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext c)
      EntityFramework.dll!System.Data.Entity.Infrastructure.Interception.InternalDispatcher<System.Data.Entity.Infrastructure.Interception.IDbConnectionInterceptor>.Dispatch<System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext>(System.Data.Common.DbConnection target, System.Action<System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext> operation, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext interceptionContext, System.Action<System.Data.Entity.Infrastructure.Interception.IDbConnectionInterceptor, System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext> executing, System.Action<System.Data.Entity.Infrastructure.Interception.IDbConnectionInterceptor, System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext> executed)
      EntityFramework.dll!System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Dispose(System.Data.Common.DbConnection connection, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext)
      EntityFramework.dll!System.Data.Entity.Internal.LazyInternalConnection.Dispose()
      EntityFramework.dll!System.Data.Entity.Internal.LazyInternalContext.DisposeContext(bool disposing)
      EntityFramework.dll!System.Data.Entity.DbContext.Dispose(bool disposing)
      EntityFramework.dll!System.Data.Entity.DbContext.Dispose()
      Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.Dispose()
      Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.RequestServicesFeature.Dispose()
      Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)
      mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3>(ref Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3 stateMachine)
      Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)
      Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.HostingApplication.ProcessRequestAsync(Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context context)
      Microsoft.AspNetCore.Server.Kestrel.dll!Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame<Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context>.RequestProcessingAsync()
      mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
      mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
      mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
      mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
      Microsoft.AspNetCore.Server.Kestrel.dll!Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure.LoggingThreadPool.RunAction.AnonymousMethod__5_0(object o)
      mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
      mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
      mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
      mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
      [Native to Managed Transition]
      kernel32.dll!BaseThreadInitThunk()
      ntdll.dll!RtlUserThreadStart()

    Thursday, March 30, 2017 8:55 PM

All replies

  • Hi Skyler Todd,

    What kind of application you are using. Winform, WPF, or others? Could you please provide related code about the issue.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 31, 2017 5:12 AM
    Moderator
  • Here is the project.json

    { "version": "1.0.0", "dependencies": { "EntityFramework": "6.1.3",

    //...Private libraries "Microsoft.AspNetCore.Mvc": "1.1.0", "Microsoft.AspNetCore.Mvc.DataAnnotations": "1.1.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", "Microsoft.AspNetCore.StaticFiles": "1.1.0", "Microsoft.Composition": "1.0.30", "Microsoft.Extensions.Caching.Memory": "1.1.0", "Microsoft.Extensions.Configuration.Binder": "1.1.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0", "Microsoft.Extensions.Configuration.Json": "1.1.0", "Microsoft.Extensions.Logging": "1.1.0", "Microsoft.Extensions.Logging.Console": "1.1.0", "Microsoft.Extensions.Logging.Debug": "1.1.0" }, "frameworks": { "net46": { "frameworkAssemblies": { "System.Web.Extensions": "4.0.0.0", "System.Net": "4.0.0.0", "System.ComponentModel.Composition": "4.0.0.0" } } }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final" }, "buildOptions": { "emitEntryPoint": true }, "scripts": { "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } }

    Here is the Main

      public class Program
    	{
    		public static void Main(string[] args)
    		{
    			var host = new WebHostBuilder()
    				.UseKestrel()
    				.UseContentRoot(Directory.GetCurrentDirectory())
    				.UseIISIntegration()
                    .ConfigureLogging(loggerFactory =>
                    {
                       //...logging config
                    })
                    .UseStartup<Startup>()
    				.Build();
    
    			host.Run();
    		}
    	}

    So as you can see we are working with the new Core Project type, but running full framework, hosted on Kestrel through IIS.

    Running on Server 2012 R2 Standard IIS 8.5.

    Monday, April 3, 2017 5:47 PM
  • Hi,

    Based on your description and related code, it seems that it is a core project, I would suggest that you could post your issue on asp.net core forum for suitable support.

    https://forums.asp.net/1255.aspx/1?ASP+NET+Core

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 4, 2017 6:01 AM
    Moderator
  • The reason I brought it here was because it seems the bug is located in System.Data and as you can see we are bringing in 4.6 framework instead of using full core support.  Is there an easy way to categorize or cross link this post?  

    Thanks,
    Skyler

    Tuesday, April 4, 2017 3:10 PM
  • Because it's stuck in the NtClose system call, a kernel stack trace would be interesting. Can you get a kernel memory dump or attach a kernel debugger?

    Tuesday, April 4, 2017 11:19 PM
  • Kalle,

    Next time it happens I will try to take a kernel memory dump.  

    I'm assuming you are talking about taking a memory dump using WinDbg in kernel mode. -kl.

    Since I am not familiar with taking stack traces from kernel, do you happen to have an MSDN link or some other link on how to accomplish a stack/memory dump in kernel mode?

    Thanks,

    Skyler

    Wednesday, April 5, 2017 10:47 PM