Skip to content

Failed to create CoreCLR, HRESULT: 0x8007001F on Catalina #34708

Closed

Description

@wfurt

I bump to this when trying to build runtime repo after sync. It is trying to use 5.0 preview build and the build fails every time.

Shining:wfurt-runtime2 furt$ /Users/furt/github/wfurt-runtime2/.dotnet/dotnet --info
Failed to create CoreCLR, HRESULT: 0x8007001F

Host (useful for support):
  Version: 5.0.0-preview.3.20169.1
  Commit:  bc28cbef85

.NET Core SDKs installed:
  5.0.100-preview.4.20202.8 [/Users/furt/github/wfurt-runtime2/.dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 5.0.0-preview.3.20170.2 [/Users/furt/github/wfurt-runtime2/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0-preview.3.20169.1 [/Users/furt/github/wfurt-runtime2/.dotnet/shared/Microsoft.NETCore.App]

I tried to run wit with COREHOST_TRACE=1 but that did not show any useful.
I'm not sure what would be best next step to debug this.

cc: @janvorli as PAL may be suspect.

Activity

  1. added
    os-macos
    on Apr 8, 2020
  2. added
    area-PAL-coreclr
    untriaged
    on Apr 8, 2020
  3. wfurt commented on Apr 8, 2020

    @wfurt
    MemberAuthor

    failing block may be clue (when running under dtruss)

    27723/0xbb9196:     40857       8      5 bsdthread_create(0x1051F4680, 0x7F9F3C805600, 0x70000F53E000)|\|\\\ = 257155072 0
    27723/0xbb91aa:         5       4      0 thread_selfid(0x0, 0x0, 0x0)|\\|\\\ = 12292522 0
    27723/0xbb91aa:        36       6      2 psynch_cvsignal(0x7F9F3C805748, 0x100, 0x0)|\\\|\\\ = 257 0
    27723/0xbb9196:     40867      42      3 psynch_cvwait(0x7F9F3C805748, 0x100000100, 0x0)|\\\|\\\ = 0 0
    27723/0xbb9196:     40879       3      0 sigaction(0xF, 0x7FFEEAB4CF78, 0x1056C3550)|\\\|\\\ = 0 0
    27723/0xbb9196:     40883       3      0 fcntl(0x0, 0x43, 0x0)|\|\\\ = 6 0
    27723/0xbb9196:     40885       2      0 fcntl(0x1, 0x43, 0x0)|\|\\\ = 7 0
    27723/0xbb9196:     40886       2      0 fcntl(0x2, 0x43, 0x0)|\|\\\ = 8 0
    27723/0xbb9196:     41094       4      1 mmap(0x0, 0x1000, 0x3, 0x1002, 0xFFFFFFFFFFFFFFFF, 0x0)|\\\|\\\ = 0x105854000 0
    27723/0xbb9196:     41102       3      0 mlock(0x105854000, 0x1000, 0x0)|\\\|\\\ = -1 35
    

    35 is EAGAIN and that seems weird. attaching whole trace.
    trace.txt

  4. wfurt commented on Apr 8, 2020

    @wfurt
    MemberAuthor

    Disabling SIP (System Integrity Protection) fixed it. But is enabled by default and requires reboot to recovery mode to disable it.

    Shining:coreclr furt$ csrutil status
    System Integrity Protection status: unknown (Custom Configuration).
    
    Configuration:
    	Apple Internal: disabled
    	Kext Signing: enabled
    	Filesystem Protections: enabled
    	Debugging Restrictions: enabled
    	DTrace Restrictions: disabled
    	NVRAM Protections: enabled
    	BaseSystem Verification: enabled
    
    This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.
    

    We may not see this in CI as we may have disabled SIP to get crash dumps.

  5. janvorli commented on Apr 8, 2020

    @janvorli
    Member

    The problem is that there are not enough resources for locking a memory page. There is a system wide limit on the number of pages that can be locked and once it is depleted, all mlock attempts fail until some process frees that memory. I've looked into it few weeks ago, let me add the issue number.

  6. wfurt commented on Apr 8, 2020

    @wfurt
    MemberAuthor

    If so, why SIP would matter? I have system with 32G of RAM.

  7. janvorli commented on Apr 8, 2020

    @janvorli
    Member

    I don't think it mattered, I think it was just a coincidence that some process has released its wired memory. See dotnet/sdk#10870 for details.

  8. removed
    untriaged
    on Apr 10, 2020
  9. added this to the 5.0 milestone on Apr 10, 2020
  10. wfurt commented on Apr 16, 2020

    @wfurt
    MemberAuthor

    It does seem like dup of #34793. It happened to me again with SIP disabled and stopping few Parallels VM brought it back to life. So it is memory constrain as @janvorli suspected.

  11. Crow-Control commented on May 21, 2020

    @Crow-Control

    @wfurt I want to add to this:
    Had the same issue on FreeBSD where ZFS was exeeding the max wired memory and thus preventing mlock from running. This is actually a bug with ZFS and FreeBSD (in contrast with this problem).

    So it's not a memory contrain, it's a system config constrain, which in FreeBSD is easily fixed with some sysctl commands. There might be a similair setting that could be changed in OSX.

    But I would like to ask the question: Do we really need to mlock this? If even Databases can run without mlock on multiplatform and thus don't hit these issues, why does DotNet need mlock?

  12. janvorli commented on May 21, 2020

    @janvorli
    Member

    @Ornias1993 the mlock is essential for correct .NET behavior. We create just a single locked page to be able to trigger flushing write buffers of all processors in the process (perform a process wide memory barrier). Without the locked page, GC and some other stuff in the runtime would not work reliably as we need to ensure that the state of all processors is synchronized.
    On Linux, we use membarrier syscall with MEMBARRIER_CMD_PRIVATE_EXPEDITED option as a primary mean to achieve that goal, but that's not available on FreeBSD. If there is some other way to achieve that on FreeBSD, it would be great to add that.

  13. Crow-Control commented on May 21, 2020

    @Crow-Control

    @janvorli I understand.
    I've thrown an email to @allanjude (he doesn't respond well to github tags, he gets too many), asking if he might know a way, as he has some experience with FreeBSD memory management afaik.

  14. allanjude commented on May 21, 2020

    @allanjude

    I am not really familiar with the DotNet stuff, but @rootwyrm helps to maintain that on FreeBSD, he might be of help here.

  15. Crow-Control commented on May 21, 2020

    @Crow-Control

    @allanjude I was more refering to general advice what options/alternatives there are to mloc on bsd ;)

  16. Crow-Control commented on May 21, 2020

    @Crow-Control

    Note:
    The error I had seems specific to FreeNAS, it is actually solved in FreeBSD itself here:
    https://docs.freebsd.org/cgi/getmsg.cgi?fetch=145846+0+archive/2019/svn-src-head/20190519.svn-src-head

    Sorry to bother :)

  17. ghost locked as resolved and limited conversation to collaborators on Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-PAL-coreclros-macos

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions