Skip to content

Failed to create CoreCLR, HRESULT: 0x8007FF02 #44417

Open

Description

@sfoslund

Issue moved from dotnet/sdk#14351


From @John0King on Wednesday, October 28, 2020 4:05:52 AM

installed version :

  • .net core sdk 3.1
  • .net core sdk 5.0 rc2

platform and hardware

on MacOs 10.15.3 with Black Mac (Non Apple hardware)

command and result

dotnet -> ok
dotnet --info -> ok
dotnet -h -> Failed to create CoreCLR, HRESULT: 0x8007FF02
dotnet new -> Failed to create CoreCLR, HRESULT: 0x8007FF02

additional info

Vs for Mac run ok,
create xamarin forms for mac run ok,
create C# project (Non .net core) run ok
create .net core console app run fail (both build and clean not work)

Activity

  1. self-assigned this
    on Nov 9, 2020
  2. janvorli commented on Nov 9, 2020

    @janvorli
    Member

    @John0King this error means that there is not even a single page of wired memory available for our use. We use one such page. There is a system-wide limit to the amount of memory that can be allocated as wired (locked via mlock). The error means that some other application has consumed all the available wired memory. I've seen several such cases reported in the past, one of such applications being parallels desktop.
    Please see #34793 and #34708 for more details.
    The error code mentioned in those issues is different - I have modified coreclr PAL after those to report more fine grained initialization errors, so the 0x8007FF02 is a new error code to indicate the issue described above.

  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Nov 10, 2020
  4. John0King commented on Nov 10, 2020

    @John0King

    but xamarin app runs fine , and also the vs for Mac. no matter what you try to ensure, sacrifice the ability to run is not acceptable,so please learn from mono

  5. added this to the Future milestone on Nov 10, 2020
  6. TanayParikh commented on Nov 13, 2020

    @TanayParikh
    Contributor

    I've seen several such cases reported in the past, one of such applications being parallels desktop.
    Please see #34793 and #34708 for more details.
    The error code mentioned in those issues is different - I have modified coreclr PAL after those to report more fine grained initialization errors, so the 0x8007FF02 is a new error code to indicate the issue described above.

    Can confirm, I'm getting Failed to create CoreCLR, HRESULT: 0x8007FF02 when I run dotnet new while Parallels Desktop is also running. Possibly of note, other applications and commands can be started and run without issue.

  7. John0King commented on Nov 13, 2020

    @John0King

    @TanayParikh In my case is different. I can confirm that the parallels desktop is not even install.

  8. janvorli commented on Nov 13, 2020

    @janvorli
    Member

    Currently, .NET Core relies on the ability to lock single memory page (4kB) for an essential function that is necessary for high performance synchronization of threads with garbage collector. It is used to emulate the FlushProcessWriteBuffers API that we use on Windows which creates a process wide memory barrier. Unfortunately, macOS doesn't support any equivalent of the membarrier syscall that we use on Linux. We didn't know of any other way to implement that functionality on macOS until very recently where we have discovered an alternative method that could possibly be used as a fall back in case there was no wired memory left. We are planning to add the new method I've mentioned as a fallback mechanism.

  9. janvorli commented on Nov 13, 2020

    @janvorli
    Member

    @John0King can you please share the output of the following commands?

    vm_stat | grep "wired"
    ulimit -a | grep "locked"
    kextstat | awk 'NR==1{ printf "%10s %s\n", $5, $6; } NR!=1{ printf "%10d %s\n", $5, $6; }' | sort -n
    

    These would show how many wired pages are there currently allocated on your machine, what is the per process limit imposed on them and what applications use them.

  10. removed their assignment
    on Nov 13, 2020
  11. John0King commented on Nov 24, 2020

    @John0King
    mac521@mac521s-iMac ~ % dotnet -h
    Failed to create CoreCLR, HRESULT: 0x8007FF02
    mac521@mac521s-iMac ~ % vm_stat | grep "wired"
    Pages wired down:                       2404175.
    mac521@mac521s-iMac ~ % ulimit -a | grep "locked"
    -l: locked-in-memory size (kbytes)  unlimited
    mac521@mac521s-iMac ~ % kextstat | awk 'NR==1{ printf "%10s %s\n", $5, $6; } NR!=1{ printf "%10d %s\n", $5, $6; }' | sort -n
         Wired Name
         12288 com.apple.security.TMSafetyNet
         16384 com.apple.AGDCPluginDisplayMetrics
         16384 com.apple.AppleFSCompression.AppleFSCompressionTypeDataless
         16384 com.apple.driver.Apple16X50ACPI
         16384 com.apple.driver.AppleIntelSlowAdaptiveClocking
         16384 com.apple.driver.AppleUSBHostMergeProperties
         16384 com.apple.iokit.IOSMBusFamily
         20480 com.apple.driver.AppleAPIC
         20480 com.apple.driver.AppleEFIRuntime
         20480 com.apple.driver.AppleHPET
         20480 com.apple.driver.AppleIntelCPUPowerManagementClient
         20480 com.apple.driver.AppleLPC
         20480 com.apple.filesystems.hfs.encodings.kext
         20480 com.apple.kext.AppleMatch
         20480 com.apple.kext.triggers
         20480 com.rehabman.driver.USBInjectAll
         20480 org.rehabman.voodoo.driver.PS2Mouse
         22496 com.apple.kpi.kasan
         23856 com.apple.kpi.dsep
         24576 com.apple.Dont_Steal_Mac_OS_X
         24576 com.apple.driver.AppleBacklightExpert
         24576 com.apple.driver.AppleSMBIOS
         24576 com.apple.driver.eficheck
         24576 com.apple.driver.usb.AppleUSBHostPacketFilter
         24576 com.apple.iokit.IOSlowAdaptiveClockingFamily
         24576 com.apple.private.KextAudit
         25312 com.apple.kpi.mach
         28672 com.apple.driver.IOSlaveProcessor
         28672 com.apple.iokit.IOEthernetAVBController
         28672 com.apple.iokit.IOReportFamily
         28672 org.rehabman.voodoo.driver.PS2Keyboard
         32768 com.apple.driver.AppleACPIButtons
         32768 com.apple.driver.AppleBacklight
         32768 com.apple.driver.AppleBusPowerController
         32768 com.apple.driver.AudioAUUC
         33280 com.apple.kpi.unsupported
         36864 com.apple.driver.AppleUpstreamUserClient
         36864 com.apple.driver.watchdog
         36864 com.apple.iokit.IOACPIFamily
         40960 com.apple.AppleGraphicsDeviceControl
         40960 com.apple.driver.IOPlatformPluginFamily
         40960 com.apple.iokit.IOUserEthernet
         40960 com.apple.kec.pthread
         45056 com.apple.driver.AppleRTC
         45056 com.apple.filesystems.autofs
         45056 org.rehabman.voodoo.driver.PS2Controller
         49152 com.apple.driver.AppleEffaceableStorage
         49152 com.apple.driver.AppleFDEKeyStore
         49152 com.apple.iokit.IOHDAFamily
         49152 com.apple.kext.CoreTrust
         49152 com.apple.nke.applicationfirewall
         49152 com.apple.security.quarantine
         50016 com.apple.kpi.bsd
         53248 com.apple.AppleFSCompression.AppleFSCompressionTypeZlib
         53248 com.apple.AppleGPUWrangler
         53248 com.apple.driver.AppleSSE
         57344 com.apple.driver.AppleSMBusController
         57344 com.apple.driver.usb.AppleUSBCommon
         57344 com.apple.iokit.IOBluetoothSerialManager
         57344 com.apple.iokit.IOSerialFamily
         61440 com.apple.driver.Apple16X50Serial
         61440 com.apple.driver.AppleEFINVRAM
         61440 com.apple.driver.AppleHV
         61440 com.apple.driver.usb.AppleUSBEHCIPCI
         61440 com.apple.iokit.IOBluetoothPacketLogger
         65536 com.apple.BootCache
         65536 com.apple.iokit.CoreAnalyticsFamily
         65536 com.apple.iokit.IONDRVSupport
         65536 com.apple.kec.Libm
         65536 org.tw.CodecCommander
         65712 com.apple.kpi.libkern
         66928 com.apple.kpi.private
         69632 org.netkas.driver.FakeSMC
         73728 com.apple.driver.IOPlatformPluginLegacy
         73728 com.apple.kext.OSvKernDSPLib
         86016 com.apple.AppleSystemPolicy
         86016 com.apple.driver.ACPI_SMC_PlatformPlugin
         86016 com.apple.driver.AppleUSBTDM
         94208 com.apple.driver.AppleAHCIPort
         94208 com.apple.driver.AppleMCCSControl
         98304 net.osx86.kexts.GenericUSBXHCI
        102400 com.apple.driver.DiskImages
        102400 com.apple.iokit.IOSCSIBlockCommandsDevice
        102400 com.apple.security.AppleImage4
        110592 com.apple.driver.AppleSEPManager
        110592 com.apple.iokit.IOAHCIFamily
        114688 com.apple.fileutil
        118784 com.apple.driver.AppleHDAController
        118784 com.apple.driver.KernelRelayHost
        122880 com.apple.driver.AppleUSBLegacyHub
        126976 com.apple.driver.AppleSMC
        139264 com.apple.driver.pmtelemetry
        143360 com.apple.iokit.IOAVBFamily
        153600 com.apple.kpi.iokit
        163840 com.apple.driver.AppleMobileFileIntegrity
        163840 com.apple.driver.AppleVirtIO
        163840 com.apple.iokit.IOAHCIBlockStorage
        163840 com.apple.iokit.IOStorageFamily
        176128 com.apple.iokit.IOSCSIArchitectureModelFamily
        192512 com.apple.iokit.IOSurface
        196608 com.apple.iokit.IONetworkingFamily
        208896 com.apple.driver.AppleIntelCPUPowerManagement
        212992 com.apple.iokit.IOUSBMassStorageDriver
        221184 com.apple.driver.usb.AppleUSBHub
        233472 com.apple.iokit.IOPCIFamily
        258048 com.apple.iokit.IOAudioFamily
        258048 com.apple.iokit.IOTimeSyncFamily
        290816 com.apple.iokit.IOSkywalkFamily
        294912 com.apple.driver.usb.AppleUSBEHCI
        331776 com.apple.driver.AppleCredentialManager
        331776 com.apple.iokit.IOGraphicsFamily
        368640 com.apple.security.sandbox
        409600 com.apple.iokit.EndpointSecurity
        425984 com.apple.filesystems.ntfs
        430080 com.insanelymac.RealtekRTL8111
        438272 com.apple.filesystems.hfs.kext
        450560 as.vit9696.WhateverGreen
        516096 as.vit9696.Lilu
        516096 com.apple.driver.AppleKeyStore
        626688 com.apple.iokit.IOUSBFamily
        634880 com.apple.driver.AppleACPIPlatform
        659456 com.apple.iokit.IOHIDFamily
        704512 com.apple.vecLib.kext
        737280 com.apple.plugin.IOgPTPPlugin
        806912 com.apple.iokit.IOAcceleratorFamily2
        901120 com.apple.GeForce
        901120 com.apple.kec.corecrypto
        946176 com.apple.driver.AppleHDA
       1024000 com.apple.iokit.IOUSBHostFamily
       1036288 com.apple.iokit.IOBluetoothFamily
       1294336 com.apple.driver.DspFuncLib
       1294336 com.apple.filesystems.apfs
       1314816 as.vit9696.AppleALC
       1753088 com.apple.nvidia.driver.NVDAGK100Hal
       2981888 com.apple.nvidia.driver.NVDAResman
    mac521@mac521s-iMac ~ % 
    mac521@mac521s-iMac ~ % 
    mac521@mac521s-iMac ~ %
  12. janvorli commented on Nov 24, 2020

    @janvorli
    Member

    Thank you @John0King. From these, I can see that the amount of allocated wired memory is currently 2404175 pages, which is 9847500800 bytes (9.17GB). From those, only ~30MB is allocated by the kernel extensions, so I assume the rest must be consumed by some application(s). However, I have not found a way to print or view wired memory usage per process.
    Can you please share what is the physical memory amount on your machine?

  13. John0King commented on Nov 24, 2020

    @John0King

    it's 12 GB RAM

  14. dustinmoris commented on Mar 19, 2021

    @dustinmoris

    The same happens when running .NET in a VS Code devcontainer.
    Nothing else is running.

  15. zaneclaes commented on Jun 4, 2021

    @zaneclaes

    Also happens running the dotnet5 arm32v7 Docker image on a Raspberry Pi 4. Rebooting has no effect.

  16. janvorli commented on Jun 5, 2021

    @janvorli
    Member

    @zaneclaes are you sure the HRESULT is exactly the same (0x8007FF02) on the RPI 4? We use different HRESULT codes for different failure locations and the problem specific to 0x8007FF02 was never observed on anything else than macOS.

  17. zaneclaes commented on Jun 5, 2021

    @zaneclaes

    @janvorli ah, no, the HRESULT was 0x80004005. Since this value is a dword, I assumed it was a pointer or memory offset of some kind (which would change with every build). I will open a new issue for this, in that case.

  18. arrowd commented on Sep 27, 2021

    @arrowd
    Contributor

    Bumped into this problem when tried to run dotnet new under FreeBSD jail. Indeed, it fails due to mlock(2) returning EPERM, because jails aren't allowed to lock pages by default.

  19. Zamana commented on Jan 18, 2022

    @Zamana

    Bumped into this problem when tried to run dotnet new under FreeBSD jail. Indeed, it fails due to mlock(2) returning EPERM, because jails aren't allowed to lock pages by default.

    This can be solved by setting allow_mlock in the jail:

    iocage set allow_mlock=1 <jail name>

  20. gwr commented on Jun 30, 2024

    @gwr
    Contributor

    Looking at what Apple did for MacOS offers some interesting ideas.
    On many OS implementations, it may be sufficient to walk all threads in the process (except the caller) and use some (yet to be determined) mechanism to force all those threads to flush state.
    I'm not sure how to do that, but walking all threads happens some places in the private implementations already (eg. on fork).

  21. dotnet-policy-service commented on Apr 9, 2026

    @dotnet-policy-service
    Contributor

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

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions