Skip to content

# Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr ************ in tid **** (SGen worker) #105389

Open

Description

@dcrespo-isaac

Android framework version

net8.0-android

Affected platform version

.NET 8.0.100, .NET 8.0.303

Description

Our Android application started to crash randomly 3 months ago when we upgraded it to .net6.
We tried to add more logging, analyze the logcat, reproduce... but all in vain.

In an attempt to stabilize the app, we have upgraded to .net8.0-android and the number of crash was significantly reduced.
This problem happens on different kind of tablets, and we excluded the idea that it could come from firmware or hardware
because they did not change and with .net framework (Xamarin) everything was running smoothly (1 crash rarely vs hundreds per day now).

Our dev and testing team (qa) are not able to reproduce the problem. Looking at the logs (SIGSEGV_Samples_logcat-with-symbols.txt), we see that all of the SIGSEGV (SEGV_MAPERR) happens on the SGen worker thread but give different backtraces.
At the end of the log file, you’ll find a SIGABRT from SGen. We’ve kept it there for reference, in case it’s related to the SIGSEGV issues.

We used dotnet-symbol to retrieve a debug version of libmonosgen-2-0.so (with symbols). Then we run ndk-stack on our
logcat to symbolize the backtraces.

Application catches nothing. So we don't have any other traces to give from it. The logcat contains the most detailled
ones we have.

FYI, we did split our crashes into 3 categories, we're not sure that they related to the SIGSEGV...
but to give you all data, the other 2 are :

  • Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid ***** (|ANR-WatchDog|), pid ***** (com.isaac.onthego)
  • Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid ***** (enableInternal), pid ***** (com.android.nfc)

What we tried :

  • Reproducing by running our acceptance tests on the tablet
    -> Nothing happens unless we run the day long tests and it's very rare. It does not give more information than what we have in production.

  • Upgrading .net version (from 8.0.100 to 8.0.303)
    -> Nothing changed.

  • Revert to .Net Framework (Xamarin)
    -> We did it in order to identify if it's related to our changes or the framework. And it worked !!!
    The number of crash were back to normal (before .net6 and .net8).

  • *** EDIT *** We also tried to disable trimming by settings <PublishTrimmed>false</PublishTrimmed> in all of our .csproj.
    -> Our APK was a little bit heavier (of course) and no changes in number of crashes..

What we are still probing :

  • Disabling concurrency on Mono Garbage collector and change the bridge-implementation to old
    -> We’ve seen numerous issues and discussions about the stability of SGen. We are hoping that this change can make a difference, as the backtraces seem to point to a problem that could be within it. If this works, it could allow us to stay with .net8 until a fix is found.

Thank you in advance for your help. We will remain vigilant if you need more details.

Steps to Reproduce

Unfortunetaly we are unable to reproduce the problem in step by step as it appears randomly on production.

Did you find any workaround?

Currently, reverting to the .Net Framework appears to be effective for us.

Relevant log output

See attached files of the description

Activity

  1. grendello commented on Jul 24, 2024

    @grendello
    Contributor

    @dcrespo-isaac thanks for the logs! They universally show that the issue is somewhere in the MonoVM's GC (SGEN), so I think the issue belongs in dotnet/runtime. Would you happen to still have the logs that have SIGABRT in them? The reason I ask is that they would contain more information before the native stack trace is dumped. The information will contain the actual assertion message logged by MonoVM - and this message is crucial to understanding what's going on. If you could share these logs, or scour them for any log lines containing any assertions coming from MonoVM and paste them here, it would be very helpful. Thanks!

  2. transferred this issue fromdotnet/androidon Jul 24, 2024
  3. ghost added
    needs-area-label
    on Jul 24, 2024
  4. added
    untriaged
    on Jul 24, 2024
  5. added and removed
    needs-area-label
    on Jul 24, 2024
  6. removed their assignment
    on Jul 24, 2024
  7. akoeplinger commented on Jul 24, 2024

    @akoeplinger
    Member

    @BrzVlad looks like a GC issue

  8. grendello commented on Jul 24, 2024

    @grendello
    Contributor

    @dcrespo-isaac Scan the logs for messages containing strings similar to * Assertion at which are tagged either with an empty string, DOTNET or a fragment of your application's ID. The message will also contain a file path which should have mono component in it.

  9. dcrespo-isaac commented on Jul 24, 2024

    @dcrespo-isaac
    Author

    Thank you for the triage.

    I've found the logcat I had analyzed for the SIGSEGV errors. In the logcat-Assertion.txt, you'll find two samples of SIGABRT preceded by :

    Assertion at /__w/1/s/src/mono/mono/metadata/object.c:4410, condition `is_ok (error)' not met, function:mono_unhandled_exception_internal, (null) assembly:System.Private.CoreLib.dll type:ArgumentNullException member:(null)

    Additional notes:

    • The SIGABRT assertion error is always the same, but it sometimes occurs on the ANR_WatchDog thread and other times on what appears to be the main thread com.isaac.onthego.
    • The two samples show errors just after the start of the application. It’s true that some errors occur then, but others occur at different moments – sadly at random times – throughout the lifetime of the application.
    • The number of SIGSEGV crashes is substantially higher than that of SIGABRT.
      -> We attempted to identify a pattern between SIGSEGV and SIGABRT, but found nothing significant. This means that they don’t precede or follow each other in any particular way.

    I will continue to update the issue if I encounter any other assertion errors.

  10. lambdageek commented on Jul 30, 2024

    @lambdageek
    Member

    @dcrespo-isaac I don't have any insight for the SIGSEGV, but for SIGABRT - does your app have a AppDomain.CurrentDomain.UnhandledException event handler installed? the assertion on object.c:4410 looks like it's due to an unhandled null reference exception during the execution of the unhandled exception handler.

  11. dcrespo-isaac commented on Jul 31, 2024

    @dcrespo-isaac
    Author

    Hi @lambdageek,

    First and foremost, thank you for your response. It is greatly appreciated. We have identified the origin of the SIGABRT:

    • There was indeed a null reference that was triggered due to a race condition at startup.
    • We discovered a setter in ANR_WatchDog that allows us to handle an ANR in our own way, rather than allowing the tool to crash our application.

    Regarding this open issue, we continue to experience problems with SIGSEGV, which is the primary subject of this issue and, regrettably, the cause of the majority of our crashes.

    We are currently deploying our reverted version to Xamarin, as it has proven to be significantly more stable. We will remain vigilant for any responses, fixes, or requests for additional information regarding this issue.

  12. removed
    untriaged
    on Aug 1, 2024
  13. added this to the Future milestone on Aug 1, 2024
  14. 47 remaining items

  15. BrzVlad commented on Jul 11, 2025

    @BrzVlad
    Member

    @ahoffmandevelopment We would need a symbolicated stacktrace first to be able to at least understand what type of failure this is. Maybe you would have more success with this ?

    I usually do it by hand using llvm-addr2line but yes, ndk-stack should work fine. You can get the symbols by extracting libmonosgen-2.0.so from the apk, then using the dotnet-symbol tool (dotnet-symbol libmonosgen-2.0.so). This will place the debug symbols next to the code .so and ndk-stack should be able to symbolicate the trace.

  16. feric-isc commented on Jul 14, 2025

    @feric-isc

    @BrzVlad Are you able to confirm if you can or cannot work with my symbolicated traces? There seemed to be ambiguity between your comment and those of others? If not I can try again

  17. BrzVlad commented on Jul 14, 2025

    @BrzVlad
    Member

    Sorry if I was ambiguous. Unfortunately the stack traces are not really useful since the resolved symbols are incorrect.

  18. feric-isc commented on Jul 14, 2025

    @feric-isc

    Hello @BrzVlad . Here are 2 additional symbolized stacktraces (with their non-symbolicated files they were generated from).

    sigsegv1.txt
    sigsegv1_symbolized.txt
    sigsegv2.txt
    sigsegv2_symbolized.txt

    Here is what I did to symbolicate. Let me know if something is not ok.

    1. Downloaded stacktrace from Crashlytics Firebase (made sure to validate the crash was with our latest version that was built with .NET SDK 8.0.410
    2. Unzipped libmonosgen-2.0.so
    3. Ran command dotnet-symbol libmonosgen-2.0.so. Generated dotnet-symbol libmonosgen-2.0.dbg
    4. Ran the following python script to generate the symbolicated traces
    import re
    import subprocess
    
    # === Configuration ===
    STACKTRACE_FILE = "sigsegv2.txt"
    OUTPUT_FILE = "sigsegv2_symbolized.txt"
    DBG_FILE = r"libmonosgen-2.0.so.dbg"
    LLVM_SYMBOLIZER = "llvm-symbolizer.exe" 
    
    # === Regex to match libmonosgen lines ===
    libmono_re = re.compile(r'#\d+\s+pc\s+(0x[0-9a-f]+)\s+libmonosgen-2\.0\.so', re.IGNORECASE)
    
    def symbolize_address(addr: str) -> str:
        """Call llvm-symbolizer with one address and return the symbolized result."""
        try:
            result = subprocess.run(
                [LLVM_SYMBOLIZER, f"--obj={DBG_FILE}", addr],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                text=True,
                check=True
            )
            return result.stdout.strip()
        except subprocess.CalledProcessError as e:
            return f"[symbolization failed: {e.stderr.strip()}]"
    
    def main():
        with open(STACKTRACE_FILE, "r", encoding="utf-8") as f_in, open(OUTPUT_FILE, "w", encoding="utf-8") as f_out:
            for line in f_in:
                f_out.write(line)
                match = libmono_re.search(line)
                if match:
                    addr = match.group(1)
                    symbolized = symbolize_address(addr)
                    for sym_line in symbolized.splitlines():
                        f_out.write(f"    ==> {sym_line}\n")
        print(f"✅ Symbolized output written to: {OUTPUT_FILE}")
    
    if __name__ == "__main__":
        main()
  19. feric-isc commented on Aug 11, 2025

    @feric-isc

    Hi @BrzVlad. Are these traces better?

  20. BrzVlad commented on Aug 12, 2025

    @BrzVlad
    Member

    The stacktraces are definitely correct this time, thanks for taking the time to symbolicate the reports. There are no symbols for libc.so and libart.so so I can't be 100% that there are no other issues somewhere else outside of the runtime. I've seen crashes before in the art GC or in other places. At least we know there no crashes in the .NET runtime.

    Having said that, if we are to assume that the first reported thread is the one that is crashing (I think this should be the case but I don't have full trust in these reports), this points to a null pointer dereference in managed code crashing the application. This normally should be impossible, a NRE should be thrown, unless the signal handlers have been tampered with. We've recently uncovered such an issue, fixed by #118085. So if your application uses Process.Start or System.Net.NetworkInformation.Ping, this means you are hitting the above mentioned issue.

  21. feric-isc commented on Aug 15, 2025

    @feric-isc

    Thanks for your feedback @BrzVlad . We checked and we don't seem to use Process.Start or System.Net.NetworkInformation.Ping. Is that something you deduced from our stacktraces? If we don't use them, do you still think it could be related to the issue you mentioned? I seem to see that it has been backported in .NET9. So if we update to latest of .NET9 and we still have the issue, what then? We are planning to do so in the next month or so...

  22. BrzVlad commented on Aug 20, 2025

    @BrzVlad
    Member

    The version containing the mentioned fix will be 9.0.10. So it will take a while before you can try it out (I think around 1.5 months). To me it just feels like the only plausible explanation, but I wouldn't be overly confident about it. In order to validate this in the meantime, you could try to use the following environment flag: MONO_DEBUG=explicit-null-checks (this avoids usage of signals when throwing NRE). You should be able to tweak the environment by adding the value to a new file and then include this file in the build as an android environment file. For example:

    <ItemGroup>
            <AndroidEnvironment Include="Platforms\Android\Environment.txt" />
    </ItemGroup>
    

    You might want to check at runtime with Environment.GetEnvironmentVariable to see that the env var is set correctly, there have been some issues in the past (only with debug builds I think).

  23. bnSonic commented on Nov 20, 2025

    @bnSonic

    I cannot say too much - but I see these crashes in the google play console (it raises the crashes to above 2% so I'm getting warnings from google)

    [split_config.arm64_v8a.apk!libmonosgen-2.0.so]
    SIGSEGV
    

    currently I have no idea if there is more information available on the google console site …

    I'm using the .net9 / maui 9.0.120 versions

  24. slepmog commented on May 11, 2026

    @slepmog

    Also plagued by this. As soon as we were forced to port from Xamarin to .net9.0-android, these started.

    11:13:16.264 19622 19622 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000003
    11:13:16.264 19622 19622 F DEBUG   : Cause: null pointer dereference
    11:13:16.264 19622 19622 F DEBUG   :     x0  0000000000000000  x1  0000000000000093  x2  00000070c001a60c  x3  00000070c001a548
    11:13:16.264 19622 19622 F DEBUG   :     x4  0000000000000000  x5  b4000070b33c8be2  x6  0000000000000029  x7  0000000000000029
    11:13:16.264 19622 19622 F DEBUG   :     x8  b400007088418000  x9  0000000000000000  x10 b4000070843caadd  x11 0000000000000000
    11:13:16.264 19622 19622 F DEBUG   :     x12 0000000000000098  x13 0000000000000084  x14 0000000000000028  x15 00000071e366f792
    11:13:16.264 19622 19622 F DEBUG   :     x16 00000070c67a3ec8  x17 00000070c66ff870  x18 00000070bf8ac000  x19 b4000070b33c8b80
    11:13:16.264 19622 19622 F DEBUG   :     x20 0000000000000093  x21 b4000070883dc048  x22 0000000000000026  x23 00000070c64e0d73
    11:13:16.264 19622 19622 F DEBUG   :     x24 00000071e374ecf0  x25 00000070c64dba73  x26 b40000706d41db50  x27 0000000000000013
    11:13:16.264 19622 19622 F DEBUG   :     x28 0000000000000178  x29 00000070c001a620
    11:13:16.264 19622 19622 F DEBUG   :     lr  00000070c67050e0  sp  00000070c001a5d0  pc  00000070c66ff87c  pst 0000000020001000
    11:13:16.264 19622 19622 F DEBUG   : backtrace:
    11:13:16.264 19622 19622 F DEBUG   :       #00 pc 000000000025087c  /data/app/~~9OHsKnAIfChr21VlFWaEzQ==/com.redacted.appname-djIIp-UazvdZ9PDIjVMj3g==/lib/arm64/libmonosgen-2.0.so (mono_guid_to_string_minimal+12) (BuildId: 74bd9f1f34dbeeaa747197639b575cbcdecba5be)
    11:13:16.264 19622 19622 F DEBUG   :       #01 pc 00000000002560dc  /data/app/~~9OHsKnAIfChr21VlFWaEzQ==/com.redacted.appname-djIIp-UazvdZ9PDIjVMj3g==/lib/arm64/libmonosgen-2.0.so (mono_debug_print_stack_frame+292) (BuildId: 74bd9f1f34dbeeaa747197639b575cbcdecba5be)
    11:13:16.264 19622 19622 F DEBUG   :       #02 pc 000000000026eca8  /data/app/~~9OHsKnAIfChr21VlFWaEzQ==/com.redacted.appname-djIIp-UazvdZ9PDIjVMj3g==/lib/arm64/libmonosgen-2.0.so (BuildId: 74bd9f1f34dbeeaa747197639b575cbcdecba5be)
    11:13:16.264 19622 19622 F DEBUG   :       #03 pc 0000000000293498  /data/app/~~9OHsKnAIfChr21VlFWaEzQ==/com.redacted.appname-djIIp-UazvdZ9PDIjVMj3g==/lib/arm64/libmonosgen-2.0.so (BuildId: 74bd9f1f34dbeeaa747197639b575cbcdecba5be)
    11:13:16.264 19622 19622 F DEBUG   :       #04 pc 0000000000270508  /data/app/~~9OHsKnAIfChr21VlFWaEzQ==/com.redacted.appname-djIIp-UazvdZ9PDIjVMj3g==/lib/arm64/libmonosgen-2.0.so (BuildId: 74bd9f1f34dbeeaa747197639b575cbcdecba5be)
    11:13:16.264 19622 19622 F DEBUG   :       #05 pc 00000000000f5108  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
    11:13:16.264 19622 19622 F DEBUG   :       #06 pc 000000000008eafc  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
    

    The entire warehouse operation is affected by this, and we cannot go back to Xamarin because that no longer even builds, because of the minimum API restriction.

  25. BrzVlad commented on May 11, 2026

    @BrzVlad
    Member

    @slepmog It's not clear if your crash is related. Could you upgrade to latest .net 10 first ?

  26. slepmog commented on May 11, 2026

    @slepmog

    @BrzVlad I thought it was related because it's the same type of crash (signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)) in the same lib (libmonosgen-2.0.so) with the same no way to catch it (the process is killed by the OS instead of triggering our try/catch).

    And we would need to switch to VS 2026 to try .net 10.
    In the past 10 years our experience has been that with .NET Android development, when you try to work with an existing project in a later version of Visual Studio, it breaks in unfathomable ways and fails to compile with hundreds of errors that don't make sense, so switching the VS version has always been a full-time, one-way, porting project.

  27. slepmog commented on Nov 20, 2026

    @slepmog

    We have done additional data collection and analysis (with AI this time), and the conclusion seems to be that mono_guid_to_string_minimal crashes when there is a Reflection.Emit/DispatchProxy frame on its stack, because that frame has a null GUID, and mono_guid_to_string_minimal crashes when it tries to read it for its log formatting purposes, thus hiding the original exception.

    The flow is:

    • We (stupidly) call a web service from an activity's OnCreate (the client code generated with dotnet-svcutil)
    • When the call takes too long, Android (rightfully) sends us SIGQUIT due to ANR
    • The Mono runtime handles SIGQUIT and tells the finalizer thread to gather the stack traces
    • mono_debug_print_stack_frame tries to format our thread's stack, which is in the middle of a web service call via a generated DispatchProxy method, and crashes because there is no GUID heap in a generated DispatchProxy method.

    I do not feel competent enough to judge if this indeed belongs to this issue or should be a separate one.

  28. BrzVlad commented on Nov 20, 2026

    @BrzVlad
    Member

    @slepmog .NET11 was just released the other day and we unified the runtime in this release. MAUI now uses CoreCLR. Could you give it a try, whether the bug is fixed in the new release ? Sounds like it should be easy to reproduce by just making the call hang.

  29. slepmog commented on Nov 20, 2026

    @slepmog

    @BrzVlad We have a net9.0-android application, not MAUI (and the OP has net8.0-android). And same VS version concerns apply like before :)

    Then again, it would appear that .NET 9 went out of support 10 days ago which I have missed. So I guess this finding is a bit late.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions