You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Android] .Net 10.0.102 random crash with SIGSEGV in major_copy_or_mark_object_concurrent_no_evacuation #123537
App should not crash randomly with a SIGSEGV in sgen.
Actual behavior
App crashes randomly with a SIGSEGV in sgen.
Regression?
Not sure. We've seen SIGSEGV crashes .Net 8 too, but didn't pus as much analysis into differentiating them. Some of the SIGSEGV in .Net were caused by the implicit-null-checks and we fixed them by MONO_DEBUG=explicit-null-checks. But this SIGSEGV crash has obliviously a different source.
Other things worth trying out, aside from the major=marksweep option from above:
MONO_GC_PARAMS=disable-non-bridge-scc,bridge-require-precise-merge. This would disable some optimizations in tarjan bridge, the perf impact should be lower than just using the new bridge.
MONO_GC_DEBUG=check-remset-consistency,nursery-canaries. This does some internal heavy validation per GC collection. It would also attempt to detect some of the buffer overflows. Only to be used locally to attempt to reproduce crashes by finding incorrect state. Might make it easier to reproduce as well in order to be able to investigate.
using CoreCLR runtime (only on .net10), which is currently experimental, but we will focus more on it for following releases. Add <UseMonoRuntime>false</UseMonoRuntime> to the csproj. This might provide better perf compared to mono.
We will have CoreCLR on Android as default for .NET11 Preview 1. We want people to try it out in the previews and solve potential issue sooner rather than later, given it has potential for better performance and stability. It would be of great help to us if you can help us investigate the CoreCLR crash. Are there any interesting logs in the console ?
We're hitting the tarjan-bridge variant of this (the stack from #123495, which was closed in favour of this issue) on .NET 10.0.10, and at a scale that might be useful to you for prioritising.
Same seven innermost frames as #123495, symbolicated against the exact production libmonosgen-2.0.so by build ID:
The allocation that triggers it differs from #123495 (a Type.Namespace read here rather than a Blazor WebView message callback), and a second cluster on the same build reaches the same crash site through sgen_alloc_obj_nolock / mono_gc_alloc_vector / mono_gparam_is_assignable_from. So the trigger looks incidental — whatever allocation happens to fill the nursery — and the crash site is the constant.
Scale, in case it helps: roughly 1,600 distinct users and 2,750 events per 30 days, out of about 2,650 users on a single production build. Spread evenly across Zebra TC52/TC52X/TC58/TC58E/TC22/TC27/TC51/TC57, Honeywell EDA52, Datalogic DT50 and Memor, plus some Samsung and Pixel; Android 8.1 through 16 with 79% on Android 14; device.class low, medium and high. Nothing about it is device-, vendor- or Android-version-specific, and it's present in every app version we have data for across three minor releases.
Worth noting that Google Play only shows about 15 users for this crash in our case. These are enterprise MDM-managed handhelds and most have Play diagnostics sharing switched off, so Play sees a small sample. Our own instrumentation reports from every device, which is where the larger numbers come from.
We also capture Android ApplicationExitInfo tombstones on device, so we have si_code (SEGV_MAPERR), full register dumps, all threads and complete memory maps for real occurrences. Happy to attach any of those if they're useful.
@erikhornstromsp Another customer was hitting this exact same crash which they confirmed to be fixed by upgrading to a net11 preview. Given we don't have a clear repro for these crashes and we are moving away from mono runtime, it looks like the long term fix for this will be upgrading to .net11.
Same class of crash here, with a reliable repro and a workaround that holds under the same load.
Environment: .NET SDK 10.0.401, Android workload 36.1.69 (Microsoft.NETCore.App.Runtime.Mono.android-arm64 10.0.12, libmonosgen-2.0.so BuildId f33bb16208644cb0bbb81076207a5931147125ee), Release with SDK defaults, Samsung Galaxy A17 (SM-A176B), Android 16, arm64. MONO_GC_PARAMS is the SDK default major=marksweep-conc.
Load: an allocation-heavy XML import (XmlSerializer, ~40 files) on 8 thread-pool workers via Parallel.ForEachAsync, while the UI thread pushes and pops popup windows. The app's own code has no unsafe code, no GCHandle, no Marshal.
Signatures over 30 minutes of repeated imports, 37 process deaths:
33× SIGSEGV (SEGV_MAPERR) inside libmonosgen-2.0.so, on .NET TP Worker threads and on SGen worker; fault addresses include 0x80000000000000, 0x20202020202028, 0x200, 0x37. SGen worker frames: #00 pc 0x2cb560 / 0x2cc154, #01 0x2e9684, #02 0x2e86e4.
4× * Assertion: should not be reached at .../sgen/sgen-scan-object.h:93
Same device and load, 30 minutes each:
MONO_GC_PARAMS
deaths / 30 min
major=marksweep-conc (default)
37
major=marksweep
0
major=marksweep,nursery-size=64m
0 (repeat run: 71 import rounds, one process)
Non-concurrent marksweep alone made the import roughly 1.5–2× slower; with a 64 MB nursery it was faster than the default (24–29 s vs 40–57 s per full import) at about 95 MB more RSS. We ship major=marksweep,nursery-size=64m via an AndroidEnvironment file for now.
@BrzVlad Unfortunately we can't share the project: it's a closed-source app we ship, so neither the repository nor code from it can be made public, and it isn't feasible to extract a standalone sample from it.
What we can offer instead:
Tombstones. Full tombstones for the crashes (SEGV_MAPERR, register dumps, all threads, memory maps) on the build noted above (libmonosgen-2.0.so BuildId f33bb16208644cb0bbb81076207a5931147125ee). The crash reproduces within minutes on the default major=marksweep-conc, so we can capture fresh ones at any time. Let us know whether you'd like them attached here or sent another way.
Diagnostic runs. We can rerun the same load on the same device with whatever settings help you, e.g. MONO_GC_DEBUG=check-remset-consistency,nursery-canaries, other MONO_GC_PARAMS, or a debug/checked runtime build if you can point us to one, and report the output.
For what it's worth, the load in short: about 40 XML files deserialized with XmlSerializer on 8 thread-pool workers via Parallel.ForEachAsync, while the UI thread keeps pushing and popping popup windows. No unsafe code, GCHandle or Marshal in our code.
#137047 is a PR that fixes a bad interaction between tarjan bridge and concurrent GC which is consistent with the failures from this report. Given .net11 release is just around the corner (which shouldn't experience this bug) and I don't have proof that this actually fixes a customer bug, it is hard to justify the backport for .net10. This fix can also help reduce GC pause times, if they were a problem.
Given I can't validate this with a repro app, if you are interested in this fix for .net10, maybe you can try it out locally. (this would mean applying this fix on top of the runtime version that you currently use, for example tag v10.0.14, then build the runtime something like ./build.sh -subset mono -os android -arch arm64 -c Release and then replace the libmonosgen-2.0.* from the mono android runtime pack.). If this proves to work fine and fix the problems, maybe I can try pushing for a backport.
Activity
MihuBot commentedon Jan 23, 2026
I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):
dotnet-policy-service commentedon Jan 23, 2026
Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Jan 26, 2026
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
BrzVlad commentedon Jan 26, 2026
Does using the non-concurrent major collector have any impact on the crashes ?
MONO_GC_PARAMS=major=marksweepBrzVlad commentedon Feb 2, 2026
Other things worth trying out, aside from the
major=marksweepoption from above:MONO_GC_PARAMS=disable-non-bridge-scc,bridge-require-precise-merge. This would disable some optimizations in tarjan bridge, the perf impact should be lower than just using thenewbridge.MONO_GC_DEBUG=check-remset-consistency,nursery-canaries. This does some internal heavy validation per GC collection. It would also attempt to detect some of the buffer overflows. Only to be used locally to attempt to reproduce crashes by finding incorrect state. Might make it easier to reproduce as well in order to be able to investigate.<UseMonoRuntime>false</UseMonoRuntime>to the csproj. This might provide better perf compared to mono.juwens commentedon Feb 2, 2026
@BrzVlad big thanks for the suggestions. Especcially the description of config flag.
Was able to test some of them.
MONO_GC_PARAMS=major=marksweeplooks very promissing. Couldn't reproduce the crash. And the app isn't slower (or at least not noticable). 👍What's the timeframe for CoreClr for Android?
Because, im unsure if it's worthy to put test/debug effort into it yet.
BrzVlad commentedon Feb 4, 2026
We will have CoreCLR on Android as default for .NET11 Preview 1. We want people to try it out in the previews and solve potential issue sooner rather than later, given it has potential for better performance and stability. It would be of great help to us if you can help us investigate the CoreCLR crash. Are there any interesting logs in the console ?
erikhornstromsp commentedon Aug 18, 2026
We're hitting the tarjan-bridge variant of this (the stack from #123495, which was closed in favour of this issue) on .NET 10.0.10, and at a scale that might be useful to you for prioritising.
Same seven innermost frames as #123495, symbolicated against the exact production libmonosgen-2.0.so by build ID:
The allocation that triggers it differs from #123495 (a Type.Namespace read here rather than a Blazor WebView message callback), and a second cluster on the same build reaches the same crash site through sgen_alloc_obj_nolock / mono_gc_alloc_vector / mono_gparam_is_assignable_from. So the trigger looks incidental — whatever allocation happens to fill the nursery — and the crash site is the constant.
Scale, in case it helps: roughly 1,600 distinct users and 2,750 events per 30 days, out of about 2,650 users on a single production build. Spread evenly across Zebra TC52/TC52X/TC58/TC58E/TC22/TC27/TC51/TC57, Honeywell EDA52, Datalogic DT50 and Memor, plus some Samsung and Pixel; Android 8.1 through 16 with 79% on Android 14; device.class low, medium and high. Nothing about it is device-, vendor- or Android-version-specific, and it's present in every app version we have data for across three minor releases.
Worth noting that Google Play only shows about 15 users for this crash in our case. These are enterprise MDM-managed handhelds and most have Play diagnostics sharing switched off, so Play sees a small sample. Our own instrumentation reports from every device, which is where the larger numbers come from.
We also capture Android ApplicationExitInfo tombstones on device, so we have si_code (SEGV_MAPERR), full register dumps, all threads and complete memory maps for real occurrences. Happy to attach any of those if they're useful.
BrzVlad commentedon Sep 1, 2026
@erikhornstromsp Another customer was hitting this exact same crash which they confirmed to be fixed by upgrading to a net11 preview. Given we don't have a clear repro for these crashes and we are moving away from mono runtime, it looks like the long term fix for this will be upgrading to .net11.
Address Mono GC Crash on Android with huge datasets (#120)
LordTyberias commentedon Sep 27, 2026
Same class of crash here, with a reliable repro and a workaround that holds under the same load.
Environment: .NET SDK 10.0.401, Android workload 36.1.69 (Microsoft.NETCore.App.Runtime.Mono.android-arm64 10.0.12, libmonosgen-2.0.so BuildId f33bb16208644cb0bbb81076207a5931147125ee), Release with SDK defaults, Samsung Galaxy A17 (SM-A176B), Android 16, arm64.
MONO_GC_PARAMSis the SDK defaultmajor=marksweep-conc.Load: an allocation-heavy XML import (XmlSerializer, ~40 files) on 8 thread-pool workers via
Parallel.ForEachAsync, while the UI thread pushes and pops popup windows. The app's own code has no unsafe code, no GCHandle, no Marshal.Signatures over 30 minutes of repeated imports, 37 process deaths:
SIGSEGV (SEGV_MAPERR)inside libmonosgen-2.0.so, on.NET TP Workerthreads and onSGen worker; fault addresses include0x80000000000000,0x20202020202028,0x200,0x37. SGen worker frames:#00 pc 0x2cb560/0x2cc154,#01 0x2e9684,#02 0x2e86e4.* Assertion: should not be reached at .../sgen/sgen-scan-object.h:93Same device and load, 30 minutes each:
major=marksweep-conc(default)major=marksweepmajor=marksweep,nursery-size=64mNon-concurrent marksweep alone made the import roughly 1.5–2× slower; with a 64 MB nursery it was faster than the default (24–29 s vs 40–57 s per full import) at about 95 MB more RSS. We ship
major=marksweep,nursery-size=64mvia an AndroidEnvironment file for now.BrzVlad commentedon Sep 28, 2026
@LordTyberias Could you share the repro project so we can reproduce as well ?
LordTyberias commentedon Oct 8, 2026
@BrzVlad Unfortunately we can't share the project: it's a closed-source app we ship, so neither the repository nor code from it can be made public, and it isn't feasible to extract a standalone sample from it.
What we can offer instead:
f33bb16208644cb0bbb81076207a5931147125ee). The crash reproduces within minutes on the defaultmajor=marksweep-conc, so we can capture fresh ones at any time. Let us know whether you'd like them attached here or sent another way.MONO_GC_DEBUG=check-remset-consistency,nursery-canaries, otherMONO_GC_PARAMS, or a debug/checked runtime build if you can point us to one, and report the output.For what it's worth, the load in short: about 40 XML files deserialized with
XmlSerializeron 8 thread-pool workers viaParallel.ForEachAsync, while the UI thread keeps pushing and popping popup windows. No unsafe code,GCHandleorMarshalin our code.BrzVlad commentedon Nov 6, 2026
#137047 is a PR that fixes a bad interaction between tarjan bridge and concurrent GC which is consistent with the failures from this report. Given .net11 release is just around the corner (which shouldn't experience this bug) and I don't have proof that this actually fixes a customer bug, it is hard to justify the backport for .net10. This fix can also help reduce GC pause times, if they were a problem.
Given I can't validate this with a repro app, if you are interested in this fix for .net10, maybe you can try it out locally. (this would mean applying this fix on top of the runtime version that you currently use, for example tag v10.0.14, then build the runtime something like
./build.sh -subset mono -os android -arch arm64 -c Releaseand then replace thelibmonosgen-2.0.*from the mono android runtime pack.). If this proves to work fine and fix the problems, maybe I can try pushing for a backport.Android: serial major GC against the Mono bridge crash; name Mono GC …