-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Description
We have many instances of our ASP.NET Core application for different customers, each running as a systemd service. One specific instance has crashed twice with "Fatal error. Failed to create RW mapping for RX memory".
The last time was on 2023-Nov-30, so this doesn't happen often. It may be because this instance of the application is particularly large, using ~300 GB RAM while loading a lot of data (once per day) and ~50 GB at other times.
Reproduction Steps
Not reproducible. Happened 2 times so far.
Expected behavior
No crash
Actual behavior
Crash with the systemd journal containing:
Fatal error. Failed to create RW mapping for RX memory
at DynamicClass.InvokeStub_ItemCollection`1..ctor(System.Object, System.Span`1<System.Object>)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
... (our code here - can provide full stack privately if needed) ...
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+ReflectionMiddlewareBinder+<>c__DisplayClass6_0.<CreateMiddleware>b__0(Microsoft.AspNetCore.Http.HttpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext(System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
Main process exited, code=killed, status=6/ABRT
(I don't have the stack trace from the first crash, unfortunately.)
Regression?
No response
Known Workarounds
No response
Configuration
.NET 8.0.0 x64, self-contained application
Ubuntu 22.04.3 this (second) time, Ubuntu 18.04.6 the first time
Running as a systemd service
The machine has 1TB RAM, but only ~36% of it was used at the time of the crash.
Other information
The only reference I can find to this error is in #80580
The last comment there includes code to reproduce it by creating many dynamic assemblies, but that code runs successfully for me on the same machine (as well as other machines), both on .NET 8 and .NET 6. We do create some dynamic assemblies via CSharpCompilation.Emit()
but I don't think we create thousands of them (but even if we did I would not expect .NET to crash like that).