Skip to content

linux ARM64 dotnet7 regression preview 4 to preview 5, 6 and 7 #72645

Closed

Description

@RobertHenry6bev

Description

When I attempt to build my application, there is an error coming from crossgen2. I get a different error with dotnet7 preview 5 vs preview 6. Both errors smell like SIGSEGV, and both smell of a corrupted heap. Perhaps other dotnet7 previews have this corruption, but it isn't noticed.

/home/msft/dotnet_all/dotnet7.0/sdk/7.0.100-preview.5.22307.18/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(464,5): error : Process terminated. Access Violation: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The application will be terminated since this platform does not support throwing an AccessViolationException. [/mnt/msft/dotnet_techempower/aspnet/benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/PlatformBenchmarks.csproj]

Reproduction Steps

Linux jammy on ARM64, using dotnet7 preview 5 or 6
Running under gdb, the top few stack frame looks like:
Switching to Thread 0xfffff7ff36a0 (LWP 2813)]

0x0000aaaaaae57160 in ILCompiler_TypeSystem_Internal_NativeFormat_TypeHashingAlgorithms__ComputeNameHashCode ()

(gdb) where

#0 0x0000aaaaaae57160 in ILCompiler_TypeSystem_Internal_NativeFormat_TypeHashingAlgorithms__ComputeNameHashCode ()

#1 0x0000aaaaaae5b214 in ILCompiler_TypeSystem_Internal_TypeSystem_InstantiatedType__GetMethod ()

#2 0x0000aaaaaae757e4 in ILCompiler_TypeSystem_Internal_TypeSystem_Ecma_EcmaModule__ResolveMemberReference ()

Expected behavior

no internal errors

Actual behavior

heap corruption

Regression?

No response

Known Workarounds

No response

Configuration

linux (ubuntu jammy 22.04) arm64 dotnet7 preview 4, 5 and 6 (4 OK[sic])
The error's presence and location seem to move around depending on the number of cores available for the job. 3 cores seemed to tickle this problem.

Other information

No response

Activity

  1. ghost added
    untriaged
    on Jul 21, 2022
  2. RobertHenry6bev commented on Jul 21, 2022

    @RobertHenry6bev
    ContributorAuthor

    area-crossgen2-coreclr


  3. agocke commented on Jul 22, 2022

    @agocke
    Member

    This might be a NativeAOT bug. @RobertHenry6bev any chance you could get a dump file for the crash?

  4. added this to the 7.0.0 milestone on Jul 25, 2022
  5. removed
    untriaged
    on Jul 25, 2022
  6. RobertHenry6bev commented on Jul 25, 2022

    @RobertHenry6bev
    ContributorAuthor

    On ARM64 Linux ubuntu 22.04 with dotnet7 preview5, I set environment variables
    COMPlus_EnableCrashReport=1
    COMPlus_DbgEnableMiniDump=1
    COMPlus_CreateDumpDiagnostics=1

    I set ulimit -c unlimited
    I set kernel config /proc/sys/kernel/core_pattern to /tmp/cores/core.%e.%p.%h.%t
    I ran my build script to build my dotnet world.
    I got 4 messages like:
    /home/robhenry/dotnet_all/dotnet7.0/sdk/7.0.100-preview.5.22307.18/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(464,5): error : Process terminated. Access Violation: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The application will be terminated since this platform does not support throwing an AccessViolationException. [/mnt/robhenry/dotnet_techempower/aspnet/benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/PlatformBenchmarks.csproj]
    I got 4 core dump files.

    I am unable to attach a zip of the corefile, since that is too large. The zip has been transmitted to agocke out-of-band.

  7. reopened this on Jul 25, 2022
  8. RobertHenry6bev commented on Jul 27, 2022

    @RobertHenry6bev
    ContributorAuthor

    I'm trying to build and run a dotnet runtime using gcc with the -fsanitize=thread (tsan), but I'm getting dynamic linking failures preventing me from making more progress

  9. 29 remaining items

  10. a74nh commented on Aug 30, 2022

    @a74nh
    Contributor

    I'm seeing this failure on latest HEAD of runtime building on Arm64 Linux.

    I see that it fixes when applying #74211, but that PR was removed with #74617

    How should I be doing my Arm64 Linux builds?

    (edit: fix link)

  11. kunalspathak commented on Aug 30, 2022

    @kunalspathak
    Contributor

    I'm seeing this failure on latest HEAD of runtime building on Arm64 Linux.

    What are the errors?

  12. AntonLapounov commented on Aug 30, 2022

    @AntonLapounov
    Contributor

    Yes, you can hit an intermittent failure building the repo like the one below:

      ILCompiler.RyuJit -> /runtime/artifacts/bin/ILCompiler.RyuJit/arm64/Release/ILCompiler.RyuJit.dll
      ILCompiler -> /runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc/ilc.dll
      Optimizing assemblies for size. This process might take a while.
    /runtime/.dotnet/sdk/7.0.100-preview.7.22377.5/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(465,5): error : Process terminated. Access Violation: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The application will be terminated since this platform does not support throwing an AccessViolationException. [/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]
    /runtime/.dotnet/sdk/7.0.100-preview.7.22377.5/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(353,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. [/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]
    

    The issue is that we are using the non-fixed crossgen2 binary from the Preview 7 NuGet package instead of the live one, which is fixed.

  13. a74nh commented on Aug 30, 2022

    @a74nh
    Contributor

    Yes, you can hit an intermittent failure building the repo like the one below

    That's the one I'm hitting, but it's every time (HiSilicon D05 with Ubuntu 18.04)

    The issue is that we are using the non-fixed crossgen2 binary from the Preview 7 NuGet package instead of the live one, which is fixed.

    Is there an easy workaround to force the build to use the live version?
    Otherwise should we just be manually reverting #74617 for now?

    Do you know roughly when this will be fixed properly?

  14. AntonLapounov commented on Aug 30, 2022

    @AntonLapounov
    Contributor

    Otherwise should we just be manually reverting #74617 for now?

    Either that or disable using server GC (DOTNET_gcServer=0).

  15. VSadov commented on Aug 30, 2022

    @VSadov
    Member

    disable using server GC (DOTNET_gcServer=0)

    I am not sure that will work. The choice of GC mode is a compile-time thing in NativeAOT.

  16. mangod9 commented on Aug 30, 2022

    @mangod9
    Member

    Guess we should revert #74617 till we update the repo to use RC1.

  17. VSadov commented on Aug 30, 2022

    @VSadov
    Member

    I do not think reverting back and forth the way crossgen2 is published has any effect on the crossgen that is actually in use, which is from Prevew 7 Nuget package.

    Replacing the binaries in the nuget cache with a locally built copy might work, but is a fragile solution.
    I can't think of a better workaround.

    (I am also annoyed by the failures, my solution is basically try again, sometimes a few times)

  18. AntonLapounov commented on Aug 30, 2022

    @AntonLapounov
    Contributor

    disable using server GC (DOTNET_gcServer=0)

    I am not sure that will work. The choice of GC mode is a compile-time thing in NativeAOT.

    Yes, it works:

    g_heap_type = (g_pRhConfig->GetgcServer() && PalGetProcessCpuCount() > 1) ? GC_HEAP_SVR : GC_HEAP_WKS;

  19. AntonLapounov commented on Aug 30, 2022

    @AntonLapounov
    Contributor

    Guess we should revert #74617 till we update the repo to use RC1.

    Note that we actually need to check whether the host architecture is ARM64 instead of checking whether the target architecture is ARM64. If you target ARM64 on an x64 machine, you don't need that workaround.

  20. VSadov commented on Aug 30, 2022

    @VSadov
    Member

    Ah, I see, SVR build is a superset of WKS, so it is possible to force crossgen2 into WKS mode.

    This would be a nice workaround!

  21. AntonLapounov commented on Aug 30, 2022

    @AntonLapounov
    Contributor

    Yep, and you can disable it in the config file just for this binary (e.g., /home/username/.nuget/packages/microsoft.netcore.app.crossgen2.linux-arm64/7.0.0-preview.7.22375.6/tools/crossgen2.runtimeconfig.json).

  22. MichalStrehovsky commented on Aug 31, 2022

    @MichalStrehovsky
    Member

    Otherwise should we just be manually reverting #74617 for now?

    I don't think reverting that one has a connection to the crossgen2 crash while crossgenning ILC that Anton described (#72645 (comment)). That pull request doesn't affect the crossgen that is in use to crossgen ILC. It affects future crossgen in a future SDK.

    I've submitted #74856 to work around.

    Yep, and you can disable it in the config file just for this binary (e.g., /home/username/.nuget/packages/microsoft.netcore.app.crossgen2.linux-arm64/7.0.0-preview.7.22375.6/tools/crossgen2.runtimeconfig.json).

    NativeAOT doesn't read runtimeconfig.json so this is likely just placebo effect. We were generating unused runtimeconfig and deps json files with NativeAOT in the past but that has been fixed.

  23. AntonLapounov commented on Aug 31, 2022

    @AntonLapounov
    Contributor

    NativeAOT doesn't read runtimeconfig.json so this is likely just placebo effect.

    Thank you for the corrections. I have never actually tried that, just assumed that if we produce a file, it should probably work. :) Setting DOTNET_gcServer=0 certainly works for me.

  24. ghost locked as resolved and limited conversation to collaborators on Sep 30, 2022
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

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions