Skip to content

[Android] .Net 10.0.102 random crash with SIGSEGV in major_copy_or_mark_object_concurrent_no_evacuation #123537

Open

Description

@juwens

Description

* thread #17, name = 'SGen worker', stop reason = breakpoint 2.1
  * frame #0: 0x0000007c70d3dfb8 libart.so`art_sigsegv_fault
    frame #1: 0x0000007c70d3db58 libart.so`art::FaultManager::HandleSigsegvFault(int, siginfo*, void*) - 18446743539240674471
    frame #2: 0x0000007f376a1c8c libsigchain.so`art::SignalChain::Handler(int, siginfo*, void*) + 372
    frame #3: 0x0000007f397d9860 [vdso]`__kernel_rt_sigreturn
    frame #4: 0x0000007bce39cfd4 libmonosgen-2.0.so`drain_gray_stack_concurrent [inlined] major_copy_or_mark_object_concurrent_no_evacuation(ptr=<unavailable>, obj=0x0000800000000000, queue=0x0000007f3778a010) at sgen-marksweep-drain-gray-stack.h:137:23
    frame #5: 0x0000007bce39cfd4 libmonosgen-2.0.so`drain_gray_stack_concurrent [inlined] major_scan_object_concurrent_no_evacuation(full_object=<unavailable>, desc=245957, queue=0x0000007f3778a010) at sgen-scan-object.h:59:3
    frame #6: 0x0000007bce39c27c libmonosgen-2.0.so`drain_gray_stack_concurrent [inlined] drain_gray_stack_concurrent_no_evacuation(queue=0x0000007f3778a010) at sgen-marksweep-drain-gray-stack.h:347:3
    frame #7: 0x0000007bce39c244 libmonosgen-2.0.so`drain_gray_stack_concurrent(queue=0x0000007f3778a010) at sgen-marksweep.c:1312:10
    frame #8: 0x0000007bce3ba510 libmonosgen-2.0.so`marker_idle_func(data_untyped=0x0000007f3778a008) at sgen-workers.c:363:3
    frame #9: 0x0000007bce3b9570 libmonosgen-2.0.so`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:219:5
    frame #10: 0x0000007f2a093d00 libc.so`__pthread_start(void*) (.__uniq.67847048707805468364044055584648682506) + 240
    frame #11: 0x0000007f2a086504 libc.so`__start_thread + 68

Reproduction Steps

At random places in our internal LOB app.

Expected behavior

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.

Known Workarounds

none

Configuration

  • .Net 10.0.102
  • Android 16
  • ARM64
  • Pixel 7a

Other information

No response

Activity

  1. added
    needs-area-label
    on Jan 23, 2026
  2. added
    untriaged
    on Jan 23, 2026
  3. MihuBot commented on Jan 23, 2026

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  4. added and removed
    needs-area-label
    on Jan 23, 2026
  5. dotnet-policy-service commented on Jan 23, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @BrzVlad
    See info in area-owners.md if you want to be subscribed.

  6. dotnet-policy-service commented on Jan 26, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
    See info in area-owners.md if you want to be subscribed.

  7. BrzVlad commented on Jan 26, 2026

    @BrzVlad
    Member

    Does using the non-concurrent major collector have any impact on the crashes ? MONO_GC_PARAMS=major=marksweep

  8. BrzVlad commented on Feb 2, 2026

    @BrzVlad
    Member

    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.
  9. self-assigned this
    on Feb 2, 2026
  10. removed
    untriaged
    on Feb 2, 2026
  11. added this to the 11.0.0 milestone on Feb 2, 2026
  12. juwens commented on Feb 2, 2026

    @juwens
    Author

    @BrzVlad big thanks for the suggestions. Especcially the description of config flag.
    Was able to test some of them.

    • UseMonoRuntime app crashed durring start. didn't investigate it further due to the experimental state.
    • MONO_GC_PARAMS=major=marksweep looks very promissing. Couldn't reproduce the crash. And the app isn't slower (or at least not noticable). 👍
    • will test remset and bridge options

    What's the timeframe for CoreClr for Android?
    Because, im unsure if it's worthy to put test/debug effort into it yet.

  13. BrzVlad commented on Feb 4, 2026

    @BrzVlad
    Member

    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 ?

  14. modified the milestones: 11.0.0, 12.0.0 on Jul 1, 2026
  15. erikhornstromsp commented on Aug 18, 2026

    @erikhornstromsp

    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:

    #00  push_object +0x10                       <-- SIGSEGV
    #01  processing_stw_step +0x688
    #02  sgen_bridge_processing_stw_step +0x1c
    #03  finish_gray_stack +0x114
    #04  collect_nursery +0x5a0
    #05  sgen_perform_collection +0x1f4
    #06  sgen_ensure_free_space +0xb8
    #07  mono_gc_alloc_string +0x84
    #08  mono_string_new_utf16_checked +0x74
    #09  mono_string_new_checked +0x78
    #10  ves_icall_RuntimeType_GetNamespace +0x78
    #11  ves_icall_RuntimeType_GetNamespace_raw +0x50
    

    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.

  16. BrzVlad commented on Sep 1, 2026

    @BrzVlad
    Member

    @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.

  17. LordTyberias commented on Sep 27, 2026

    @LordTyberias

    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.

  18. BrzVlad commented on Sep 28, 2026

    @BrzVlad
    Member

    @LordTyberias Could you share the repro project so we can reproduce as well ?

  19. LordTyberias commented on Oct 8, 2026

    @LordTyberias

    @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.

  20. BrzVlad commented on Nov 6, 2026

    @BrzVlad
    Member

    #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions