Repository navigation
Description
Description
I'm encountering random segmentation faults (and sometimes AccessViolationException and NullReferenceException) when running a dotnet 8.0 console app on 32-bit ARM linux. It seems to mainly occur for me when it attempts to connect to a SignalR hub as a client.
Reproduction Steps
I have pushed a small repro app pair here.
Note that in addition to the crashing console app, it also contains a trivially simple SignalR webapp that I've deployed to azure when reproducing. (Note the "[CHANGE THIS TO YOUR WEBAPP URL]" line in the console app)
The console app code just tries to make a SignalR connection over websockets and send/receive a few MessagePack messages before exiting.
When running the console app repeatedly, it has a random chance of encountering the issue, after something like 10 to 100 attempts. (a helper bash loop .sh is included)
Expected behavior
Can run repeatedly without crashing.
Actual behavior
Approximately 5% of the time it fails with simply Segmentation fault.
I have uploaded a core crash dump file of one of the segfault occurrences here
On some occasions it randomly has a NullReferenceException, with additional stack trace info:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.GetStateMachineBox[TStateMachine](TStateMachine& stateMachine, Task`1& taskField)
at Microsoft.AspNetCore.SignalR.Client.HubConnection.HandshakeAsync(ConnectionState startingConnectionState, Int32 protocolVersion, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner(CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync(CancellationToken cancellationToken)
at Program.<Main>$(String[] args)
at Program.<Main>(String[] args)
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AwaitUnsafeOnCompleted[TAwaiter](TAwaiter& awaiter, IAsyncStateMachineBox box)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Fatal error. Internal CLR error. (0x80131506)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.Tasks.Task+<>c.<ThrowAsync>b__128_1(System.Object)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Regression?
It seems to work fine (even with thousands of attempts) when changing the csproj back to dotnet 6.0 instead of 8.0.
(I can't test dotnet 7.0 on this ARM device due to the higher glibc requirement 7.0 has)
Known Workarounds
Downgrading the csproj to dotnet 6.0
Configuration
Custom linux OS running on 32-bit ARM linux IoT device.
Problem seems specific to 32-bit ARM. Ran repeatedly on a different custom ARM64 device with no issues.
Other information
On some rare occasions with very similar code (from my team's proprietary app), it encountered this AccessViolationException, which I suspect is stemming from the same cause:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ForceAuthenticationAsync>d__150`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].ClearStateUponCompletion()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ForceAuthenticationAsync>d__150`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ForceAuthenticationAsync>d__150`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
at System.Threading.Tasks.Task.RunContinuations(System.Object)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(Int32)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<Int32>, Int32)
at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(Int32)
at System.Net.Security.SslStream+<ReceiveHandshakeFrameAsync>d__151`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ReceiveHandshakeFrameAsync>d__151`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ReceiveHandshakeFrameAsync>d__151`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<ReceiveHandshakeFrameAsync>d__151`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Threading.ThreadPool+<>c.<.cctor>b__52_0(System.Object)
at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SignalCompletion()
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(Int32)
at System.Net.Security.SslStream+<EnsureFullTlsFrameAsync>d__161`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1+StateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<EnsureFullTlsFrameAsync>d__161`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1+StateMachineBox`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.Security.SslStream+<EnsureFullTlsFrameAsync>d__161`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Net.Security, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Threading.ThreadPool+<>c.<.cctor>b__52_0(System.Object)
at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SignalCompletion()
at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(Boolean)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal()
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationAsyncSuccess(Int32, System.Net.Sockets.SocketFlags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionCallback(Int32, System.Net.Sockets.SocketFlags, System.Net.Sockets.SocketError)
at System.Net.Sockets.SocketAsyncEventArgs.TransferCompletionCallbackCore(Int32, System.Memory`1<Byte>, System.Net.Sockets.SocketFlags, System.Net.Sockets.SocketError)
at System.Net.Sockets.SocketAsyncContext+OperationQueue`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ProcessAsyncOperation(System.__Canon)
at System.Net.Sockets.SocketAsyncContext+ReadOperation.System.Threading.IThreadPoolWorkItem.Execute()
at System.Net.Sockets.SocketAsyncContext.HandleEvents(SocketEvents)
at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
dotnet-policy-service commentedon May 17, 2024
Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.
rzikm commentedon May 20, 2024
Is it possible to check if your Linux OS flavor uses 64bit
time_t? I am aware that couple of distributions moved to 64bit to avoid the year 2038 problem, which creates a binary break for ARM32 platform. This announcement may be relevant dotnet/core#9285.I have seen our tests suite occasionally crash on ARM32 Debian 12 (on main/9.0), possibly the same issue (but we disabled runs on that specific platform due to #101444 (comment) so I did not investigate further).
maf1024 commentedon May 20, 2024
Looking at the result of a
printf("size of time_t is: %d\n", sizeof(time_t));check using our platform-specific gcc and running it on our hardware, it says 4 bytes, so it seems it's 32-bittime_t.filipnavara commentedon May 20, 2024
Unfortunately I am not sure that this test necessarily works. It still depends on the
_TIME_BITSbuild option and the system would somehow have to set it globally and unconditionally (or for the OpenSSL build, specifically).maf1024 commentedon May 23, 2024
Is there something I can try to run to more conclusively answer the
time_tquestion?cw-ametek commentedon May 24, 2024
I think this may be the same issue that I have been tracking down on our ARM32 (nxp imx6q) embedded platform running Linux.
The fault can be reproduced using an unmodified dotnet 8 webapi sample program:
For me the segmentation fault only seems to occur on the first web request, and is much more likely to happen with multiple simultaneous requests.
I've used this script running on the device to automate the process:
With a single request, the failure rate is only about 3%, but goes up to about 25% with 4 or more requests.
.net7 shows the same fault, but .net6 works without any problems.
ARM64 and Ubuntu in WSL did not show the problem.
The kernel (5.4.147) is compiled with CONFIG_64BIT_TIME, but glibc is only version 2.31
I can't see any indication that _TIME_BITS is being defined anywhere, so I think it is just 32 bit.
I can collect a coredump if that will help.
Sometimes I get the AccessViolationException instead of a segmentation fault:
jkotas commentedon May 24, 2024
This looks like a GC hole.
37 remaining items
AndreyLalaev commentedon Aug 29, 2025
@JensNordenbro, interesting. Could you please describe how you tested? In our case (iMX6Q with custom Yocto distro) .NET8 and later crashes :/
JensNordenbro commentedon Aug 29, 2025
Well. I extracted the arm32 dotnet 8 runtime zip in a folder and added it to the path. Then I just ran my framework dependent app using dotnet xxx.dll and it worked great.
Mono experiment was selfcontained.
What specifics do you want to know about @AndreyLalaev ?
AndreyLalaev commentedon Aug 29, 2025
@JensNordenbro, could you say which kernel version & yocto release you used for iMX6?
JensNordenbro commentedon Sep 4, 2025
@AndreyLalaev :
yocto: scarthgap
kernel: NXP fork, 6.6.3
libc: libc6 2.39+git0+273a835fe7-r0
...again (dotnet works fine on this conf)
yogeshvarshney commentedon Feb 6, 2026
@JensNordenbro : Are you pointing the issue of Random segmentation is not observing with Cortex A9 imx6q dual core/quad core in your testing in below mentioned configuration?
yocto: scarthgap
kernel: NXP fork, 6.6.3
libc: libc6 2.39+git0+273a835fe7-r0
Dotnet Runtime: 8.0 /9.0 /above
I am currently in yocto kirkstone and kernel 5.15. want to resolve this issue, if you point towards it is not observed in kernel 6.6.3 and glibc 2.39 then we can plan to upgrade.
SOUBI-P commentedon Feb 16, 2026
I think I have encountered the same issue with my project but in .NET10. When I run the project on Linux-x64 or on Windows-x64. There is no problem at all. But when I run it on a Linux-arm32, I get random segmentation fault.
There was no issue in .NET6.
The issue is present in .NET8 and .NET10.
Configuration:
.NET: 10.0.3
OS: Debian Bookworm 12.13
Kernel: Linux 6.1.0-10-armmp armv7l
Architecture: ARM 32 bit
Processor: NXP i.MX 6 Dual core Arm Cortex A9
Reproduction process:
I have created a small project that reproduce the issue. When I run it, the segmentation fault happen in the next few minutes.
Repo:
https://github.com/SOUBI-P/WorkerTest.gitI have also check what happen when the segfault appears with GDB:
Thread 23 ".NET TP Worker" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa391b400 (LWP 3704)]
0xa817a28a in ?? ()
(gdb) bt
#0 0xa817a28a in ?? ()
#1 0xa08bb060 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info thread
Id Target Id Frame
1 Thread 0xb6cfe020 (LWP 3680) "WorkerTest" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
2 Thread 0xb67af400 (LWP 3682) ".NET SynchManag" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
3 Thread 0xb5dff400 (LWP 3683) ".NET EventPipe" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
4 Thread 0xb53ff400 (LWP 3684) ".NET DebugPipe" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
5 Thread 0xb49ff400 (LWP 3685) ".NET Debugger" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
6 Thread 0xb11fe400 (LWP 3686) ".NET Finalizer" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
7 Thread 0xae66e400 (LWP 3687) ".NET Tiered Com" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
8 Thread 0xab110400 (LWP 3689) ".NET File Watch" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
9 Thread 0xaa227400 (LWP 3690) "Console logger " __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
10 Thread 0xa9a02400 (LWP 3691) ".NET SigHandler" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
11 Thread 0xa91d5400 (LWP 3692) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
12 Thread 0xa89d0400 (LWP 3693) ".NET TP Gate" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
14 Thread 0xa8166400 (LWP 3695) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
15 Thread 0xa7961400 (LWP 3696) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
--Type for more, q to quit, c to continue without paging--c
16 Thread 0xa715c400 (LWP 3697) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
17 Thread 0xa6957400 (LWP 3698) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
18 Thread 0xa6144400 (LWP 3699) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
19 Thread 0xa592f400 (LWP 3700) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
20 Thread 0xa512a400 (LWP 3701) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
21 Thread 0xa4925400 (LWP 3702) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
22 Thread 0xa4120400 (LWP 3703) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
24 Thread 0xa3116400 (LWP 3705) ".NET TP Worker" 0xb6d9c4d8 in __GI_sched_yield ()
at ../sysdeps/unix/syscall-template.S:120
25 Thread 0xa2911400 (LWP 3706) ".NET TP Worker" 0xb6d9c4d8 in __GI_sched_yield ()
at ../sysdeps/unix/syscall-template.S:120
26 Thread 0xa210c400 (LWP 3707) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
27 Thread 0xa1907400 (LWP 3708) ".NET TP Worker" 0xb6d9c4d8 in __GI_sched_yield ()
at ../sysdeps/unix/syscall-template.S:120
28 Thread 0xa898b400 (LWP 3785) ".NET Timer" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
29 Thread 0xa10c2400 (LWP 3786) ".NET TP Worker" __libc_do_syscall ()
at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
(gdb)
JensNordenbro commentedon Feb 16, 2026
@yogeshvarshney , in my case it worked on nxp in the configuration mentioned above. Good luck 🤪
@jkotas, @janvorli, this does not yield a good quality impression for dotnet. Even if it is because of other components..
SOUBI-P commentedon Feb 17, 2026
I can also reproduce the issue with docker, on the .NET8/debian 12 image.
Linux x64:
docker buildx build --platform linux/amd64 -t worker-net8-x64 .docker run worker-net8-x64=> No issue
Linux arm64:
docker buildx build --platform linux/arm64/v8 -t worker-net8-arm64 .docker run worker-net8-arm64=> No issue
Linux arm32:
docker buildx build --platform linux/arm/v7 -t worker-net8-arm64 .docker run worker-net8-arm64=> Crash
Output:
I have push the dockerfile on my repo. All containers use the mcr.microsoft.com/dotnet/runtime:8.0-bookworm-slim image.
filipnavara commentedon Feb 17, 2026
@SOUBI-P That's completely different issue. Running .NET under qemu-user is not supported precisely because of random asserts like that.
ebaumj commentedon Mar 3, 2026
After a few days of investigation, i managed to get rid of the segmentation faults with the following setup:
I used the following App for Testing:
Program.cs
TestApp.csproj:
Environment Variable on Target System (IMPORTANT):
I Ran the following script with no crashes at all:
also, i performed a stress test with the hey utility and the server did not crash:
I also tested the same App with those differences in the Build Configuration, there seems to be no differences in term of stability:
In conclusion, the environment setting
DOTNET_EnableWriteXorExecute=0seems to do the trick. however, i have not performed any long term tests on performance or stability, so please take those results with a grain of salt.AndreyLalaev commentedon Mar 4, 2026
@ebaumj, oh, it looks like you are right. The same hack helps with .NET10.
How did you find this variable?
ebaumj commentedon Mar 4, 2026
I found this thread (#80580) which would mention the variable, so i decided to try it out. i would not consider this workaround as a solution, as it might allow for remote code execution, but it could lead to insights when trying to fix the bug. also, it could be used when dealing with local only systems
maf1024 commentedon Mar 23, 2026
@ebaumj I dusted off my repro code from 2024 and, after confirming it was still randomly crashing as-is, applied that environment variable and it's been crash-free for a few thousand iterations now. 👍
(I can only test with 8.0 and not with 10.0, since my device is stuck on glibc 2.26)
And I concur, this feels more like a workaround than a proper fix.
I should also point out that attempting to set this via a .runtimeconfig.json with
"System.Runtime.EnableWriteXorExecute": falsedoes not seem to fix it and I still get random crashes with that route. I'm guessing that an environment variable is somehow taking effect sooner in startup compared to runtimeconfig?ebaumj commentedon Mar 24, 2026
is is likely that that the setting applies before the startup of the app, as it affects the way dotnet allocates memory for execution