w3wp.exe halted with unhandled exception after reboot
See original GitHub issueDescribe 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Troubleshoot application pool crashes on Cloud Services
Step 5: Check for unhandled exceptions in the w3wp.exe or WaWorkerHost.exe process. To also check for any unhandled exceptions that caused the ......
Read more >Net Framework: exception in w3wp.exe
It was caused by updates of .Net Framework 4.5. I uninstalled last update. It solved the problem. Tip: How to check event viewer....
Read more >An unhandled win32 exception occurred in w3wp.exe IIS ...
Find answers to An unhandled win32 exception occurred in w3wp.exe IIS Worker ... when error happen this website app pool will be rebooted....
Read more >An unhandled Microsoft .Net Framework exception occurred in ...
Open it, go to the Details tab, find the w3wp.exe process by process ID and run the “Create dump file” command with a...
Read more >Cannot login in Smart Client and Management Client because ...
Cannot login in Smart Client and Management Client because w3wp process crashes with unhandled .NET exception every day and leads to w3wp service...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After disabling the option Turn on fast startup (recommended) the error did not occur anymore. This matches my assumption that the error is caused by an invalid resume from power off status.
To change this option, go to
Control Panel\Hardware and Sound\Power Options
and then selectChose what the power buttons do
from the left pane.Yes, I still have an application, that runs as an auto-started Windows Service to provide a simple gRPC API. So it ‘runs’ after boot. But I have to manually restart it every morning, otherwise on first access it fails with:
Application is now running on net60 and is built with VS2022.
I have not installed this on different machines yet.
The log file of previous issues is on local harddisk, so nothing special there, I think.
Could this be an issue with process reactivation after a shutdown? See the
Faulting application start time: 0x01d80927f994fcb1
. This can be converted to 1/14/2022, 9:20:30 AM. But the corresponding event is from 1/17. In the meantime, the computer was shut down for the weekend (thus closing any opened files). If now the process gets reactivated only (not restarted), it might refer to an invalid ‘open file’?