Skip to content

w3wp.exe halted with unhandled exception after reboot #24997

@gkeongit

Description

@gkeongit

Describe the bug

After starting my machine, all w3wp.exe processes for my ASP.NET Core applications were terminated due to an unhandled exception.

To Reproduce

I did not reproduce it yet, but I could attach a debugger to one of the w3wp.exe processes and isolate the following info:

// in AspNetCoreModuleV2\InProcessRequestHandler\inprocessapplication.cpp, line 190:

void IN_PROCESS_APPLICATION::ExecuteApplication()
{
// ...
// Line 274: 

	bool clrThreadExited;
	{
		auto redirectionOutput = LoggingHelpers::CreateOutputs(
						m_pConfig->QueryStdoutLogEnabled(),
						m_pConfig->QueryStdoutLogFile(),
						QueryApplicationPhysicalPath(),
						m_stringRedirectionOutput
				);
				// ...
				// Exception thrown at the end of this scope, when destructor of redirectionOutput 
				// calls d'tor of FileRedirectionOutput for stdout.log
	}

// There, in AspNetCoreModuleV2\CommonLib\RedirectionOutput.cpp, line 85:

FileRedirectionOutput::~FileRedirectionOutput()
{
	if (m_file.is_open())
	{
		// closing the stream attempts to clear the state
		m_file.close();
		//...
				
				
// then, in include\xiosbase, line 247:     

void __CLR_OR_THIS_CALL clear(iostate _State, bool _Reraise) { // set state, possibly reraise exception
	_State &= _Statmask;
	_Mystate             = _State;
	const auto _Filtered = _State & _Except;
	if (_Filtered) {
		if (_Reraise) {
		_RERAISE;
		}

		const char* _Msg;
		if (_Filtered & ios_base::badbit) {
			_Msg = "ios_base::badbit set";
		} else if (_Filtered & ios_base::failbit) {
			_Msg = "ios_base::failbit set";
		} else {
			_Msg = "ios_base::eofbit set";
		}

		_THROW(failure(_Msg));
		
		
		
// The _Msg thrown is "ios_base::failbit set";

The FileRedirectionOutput refers to the stdout log of yesterday, aspnetcore-stdout_20200817161241_724.log. This file was created, modified and accessed last time yesterday, ‎August ‎17, ‎2020, ‏‎6:12:42 PM. In the meantime, the machine has been shut down and today restarted.

Exceptions (if any)

Unhandled exception at 0x00007FFA820BDB9E (ucrtbase.dll) in w3wp.exe: Fatal program exit requested.

Further technical details

  • ASP.NET Core version

TargetFramework netcoreapp3.1
Microsoft.AspNetCore FileVersion 3.100.320.12812

  • Include the output of dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.401
 Commit:    5b6f5e5005

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.401\

Host (useful for support):
  Version: 3.1.7
  Commit:  fcfdef8d6b

.NET Core SDKs installed:
  3.1.107 [C:\Program Files\dotnet\sdk]
  3.1.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
    VS2019 Version 16.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-iisIncludes: IIS, ANCMinvestigateseverity-nice-to-haveThis label is used by an internal tooltask

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions