Skip to content

Failed to gracefully shutdown application (IIS Hang) #7367

@FlorianRainer

Description

@FlorianRainer

on application pool recycle (automatic by duration) and under high load i often get the following entry in event log Failed to gracefully shutdown application 'MACHINE/WEBROOT/APPHOST/WEBNAME'.

this was already happen in 2.1 with outproc, but now i've updated to 2.2 with hostingModel="InProcess", but i get a additional eventlog entry:

CoreCLR Version: 4.6.27207.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException: The handle is invalid
   at System.ConsolePal.WindowsConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.WriteLine(String value)
   at System.IO.SyncTextWriter.WriteLine(String value)
   at System.Console.WriteLine(String value)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<>c__DisplayClass6_0.<AttachCtrlcSigtermShutdown>g__Shutdown|0()
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<>c__DisplayClass6_0.<AttachCtrlcSigtermShutdown>b__1(Object sender, EventArgs eventArgs)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.AppContext.OnProcessExit(Object sender, EventArgs e)

I use overlapped recycling, the new process is already stated, but i need to recycle manualy else the IIS is not processing requests anymore, they just timed out.

Setup:

  • Windows Server 2012 R2
  • IIS 8.5
  • .net core runtime and hosting bundle 2.2.1
  • overlapped recycling enabled
  • web: preload enabled = true
  • application pool: start mode always running
  • 32bit application

any idea why this exception happens?
the related code should be this https://github.com/aspnet/Hosting/blob/master/src/Microsoft.AspNetCore.Hosting/WebHostExtensions.cs#L142 (this Console.Log)

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-iisIncludes: IIS, ANCM

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions