dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.98k stars 4.66k forks source link

LoadJit function failing in CLR #90135

Open Kundanbharti opened 1 year ago

Kundanbharti commented 1 year ago

Description

WinUI3 application with .net6 core, we are observing a crash while running the application with below call stack. There is no indication on why it has failed but it does fail when CLR has been uninitialized or the runtime binaries are not installed or corrupted. Below is the call stack.

coreclr.dll!EEPolicy::HandleFatalError(unsigned int exitCode, unsigned int address, const wchar_t * pszMessage, _EXCEPTION_POINTERS * pExceptionInfo, const wchar_t * errorSource, const wchar_t * argExceptionString) Line 777 C++
>   coreclr.dll!UnsafeJitFunction(PrepareCodeConfig * config, COR_ILMETHOD_DECODER * ILHeader, CORJIT_FLAGS flags, unsigned long *) Line 13173  C++
    coreclr.dll!MethodDesc::JitCompileCodeLocked(PrepareCodeConfig * pConfig, ListLockEntryBase<NativeCodeVersion> * pEntry, unsigned long * pFlags, CORJIT_FLAGS *) Line 1051  C++
    coreclr.dll!MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig * pConfig, ListLockEntryBase<NativeCodeVersion> * pEntry) Line 920   C++
    coreclr.dll!MethodDesc::JitCompileCode(PrepareCodeConfig * pConfig) Line 860    C++
    coreclr.dll!MethodDesc::PrepareILBasedCode(PrepareCodeConfig * pConfig) Line 439    C++
    [Inline Frame] coreclr.dll!MethodDesc::PrepareCode(PrepareCodeConfig *) Line 332    C++
    coreclr.dll!CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc * pMethodDesc, CallerGCMode callerGCMode, bool * doBackpatchRef, bool * doFullBackpatchRef) Line 1701  C++
    coreclr.dll!MethodDesc::DoPrestub(MethodTable * pDispatchingMT, CallerGCMode callerGCMode) Line 2215    C++
    coreclr.dll!ECall::PopulateManagedCastHelpers() Line 173    C++
    coreclr.dll!SystemDomain::LoadBaseSystemClasses() Line 1486 C++
    coreclr.dll!SystemDomain::Init() Line 1274  C++
    coreclr.dll!EEStartupHelper() Line 998  C++
    coreclr.dll!EEStartup() Line 1162   C++
    coreclr.dll!EnsureEEStarted() Line 322  C++
    coreclr.dll!CorHost2::Start() Line 102  C++
    coreclr.dll!coreclr_initialize(const char * exePath, const char * appDomainFriendlyName, int propertyCount, const char * * propertyKeys, const char * * propertyValues, void * * hostHandle, unsigned int * domainId) Line 251  C++
    hostpolicy.dll!coreclr_t::create(const std::wstring & libcoreclr_path, const char * exe_path, const char * app_domain_friendly_name, const coreclr_property_bag_t & properties, std::unique_ptr<coreclr_t,std::default_delete<coreclr_t>> & inst) Line 58   C++
    hostpolicy.dll!`anonymous namespace'::create_coreclr() Line 81  C++
    hostpolicy.dll!corehost_main(const int argc, const wchar_t * * argv) Line 426   C++
    hostfxr.dll!execute_app(const std::wstring & impl_dll_dir, corehost_init_t * init, const int argc, const wchar_t * * argv) Line 147 C++
    hostfxr.dll!`anonymous namespace'::read_config_and_execute(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map<enum known_options,std::vector<std::wstring,std::allocator<std::wstring>>,known_options_hash,std::equal_to<enum known_options>,std::allocator<std::pair<enum known_options const ,std::vector<std::wstring,std::allocator<std::wstring>>>>> & opts, int new_argc, const wchar_t * * new_argv, host_mode_t mode, const bool is_sdk_command, wchar_t * out_buffer, int buffer_size, int * required_buffer_size) Line 533    C++
    hostfxr.dll!fx_muxer_t::handle_exec_host_command(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map<enum known_options,std::vector<std::wstring,std::allocator<std::wstring>>,known_options_hash,std::equal_to<enum known_options>,std::allocator<std::pair<enum known_options const ,std::vector<std::wstring,std::allocator<std::wstring>>>>> & opts, int argc, const wchar_t * * argv, int argoff, host_mode_t mode, const bool is_sdk_command, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 1018  C++
    hostfxr.dll!fx_muxer_t::execute(const std::wstring host_command, const int argc, const wchar_t * * argv, const host_startup_info_t & host_info, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 594  C++
    hostfxr.dll!hostfxr_main_startupinfo(const int argc, const wchar_t * * argv, const wchar_t * host_path, const wchar_t * dotnet_root, const wchar_t * app_path) Line 61  C++
    CWAInstaller.exe!005aeada() Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for CWAInstaller.exe]  
    CWAInstaller.exe!005aee1a() Unknown
    CWAInstaller.exe!005aff4c() Unknown
    kernel32.dll!@BaseThreadInitThunk@12()  Unknown
    ntdll.dll!__RtlUserThreadStart()    Unknown
    ntdll.dll!__RtlUserThreadStart@8()  Unknown

Reproduction Steps

while launching the application.

Expected behavior

This shouldn't crash.

Actual behavior

Its crashing with above given call stack.

Regression?

NA

Known Workarounds

NA

Configuration

No response

Other information

No response

ghost commented 1 year ago

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

Issue Details
### Description With winUI3 application with .net6 core we are observing a crash while running the application with below call stack. There is no indication on why it has failed but it does fail when CLR has been uninitialized or the runtime binaries are not installed or corrupted. Below is the call stack. coreclr.dll!EEPolicy::HandleFatalError(unsigned int exitCode, unsigned int address, const wchar_t * pszMessage, _EXCEPTION_POINTERS * pExceptionInfo, const wchar_t * errorSource, const wchar_t * argExceptionString) Line 777 C++ > coreclr.dll!UnsafeJitFunction(PrepareCodeConfig * config, COR_ILMETHOD_DECODER * ILHeader, CORJIT_FLAGS flags, unsigned long *) Line 13173 C++ coreclr.dll!MethodDesc::JitCompileCodeLocked(PrepareCodeConfig * pConfig, ListLockEntryBase * pEntry, unsigned long * pFlags, CORJIT_FLAGS *) Line 1051 C++ coreclr.dll!MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig * pConfig, ListLockEntryBase * pEntry) Line 920 C++ coreclr.dll!MethodDesc::JitCompileCode(PrepareCodeConfig * pConfig) Line 860 C++ coreclr.dll!MethodDesc::PrepareILBasedCode(PrepareCodeConfig * pConfig) Line 439 C++ [Inline Frame] coreclr.dll!MethodDesc::PrepareCode(PrepareCodeConfig *) Line 332 C++ coreclr.dll!CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc * pMethodDesc, CallerGCMode callerGCMode, bool * doBackpatchRef, bool * doFullBackpatchRef) Line 1701 C++ coreclr.dll!MethodDesc::DoPrestub(MethodTable * pDispatchingMT, CallerGCMode callerGCMode) Line 2215 C++ coreclr.dll!ECall::PopulateManagedCastHelpers() Line 173 C++ coreclr.dll!SystemDomain::LoadBaseSystemClasses() Line 1486 C++ coreclr.dll!SystemDomain::Init() Line 1274 C++ coreclr.dll!EEStartupHelper() Line 998 C++ coreclr.dll!EEStartup() Line 1162 C++ coreclr.dll!EnsureEEStarted() Line 322 C++ coreclr.dll!CorHost2::Start() Line 102 C++ coreclr.dll!coreclr_initialize(const char * exePath, const char * appDomainFriendlyName, int propertyCount, const char * * propertyKeys, const char * * propertyValues, void * * hostHandle, unsigned int * domainId) Line 251 C++ hostpolicy.dll!coreclr_t::create(const std::wstring & libcoreclr_path, const char * exe_path, const char * app_domain_friendly_name, const coreclr_property_bag_t & properties, std::unique_ptr> & inst) Line 58 C++ hostpolicy.dll!`anonymous namespace'::create_coreclr() Line 81 C++ hostpolicy.dll!corehost_main(const int argc, const wchar_t * * argv) Line 426 C++ hostfxr.dll!execute_app(const std::wstring & impl_dll_dir, corehost_init_t * init, const int argc, const wchar_t * * argv) Line 147 C++ hostfxr.dll!`anonymous namespace'::read_config_and_execute(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map>,known_options_hash,std::equal_to,std::allocator>>>> & opts, int new_argc, const wchar_t * * new_argv, host_mode_t mode, const bool is_sdk_command, wchar_t * out_buffer, int buffer_size, int * required_buffer_size) Line 533 C++ hostfxr.dll!fx_muxer_t::handle_exec_host_command(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map>,known_options_hash,std::equal_to,std::allocator>>>> & opts, int argc, const wchar_t * * argv, int argoff, host_mode_t mode, const bool is_sdk_command, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 1018 C++ hostfxr.dll!fx_muxer_t::execute(const std::wstring host_command, const int argc, const wchar_t * * argv, const host_startup_info_t & host_info, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 594 C++ hostfxr.dll!hostfxr_main_startupinfo(const int argc, const wchar_t * * argv, const wchar_t * host_path, const wchar_t * dotnet_root, const wchar_t * app_path) Line 61 C++ CWAInstaller.exe!005aeada() Unknown [Frames below may be incorrect and/or missing, no symbols loaded for CWAInstaller.exe] CWAInstaller.exe!005aee1a() Unknown CWAInstaller.exe!005aff4c() Unknown kernel32.dll!@BaseThreadInitThunk@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ### Reproduction Steps while launching the application. ### Expected behavior This shouldn't crash. ### Actual behavior Its crashing with above given call stack. ### Regression? NA ### Known Workarounds NA ### Configuration _No response_ ### Other information _No response_
Author: Kundanbharti
Assignees: -
Labels: `area-Host`
Milestone: -
ghost commented 1 year ago

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

Issue Details
### Description WinUI3 application with .net6 core, we are observing a crash while running the application with below call stack. There is no indication on why it has failed but it does fail when CLR has been uninitialized or the runtime binaries are not installed or corrupted. Below is the call stack. coreclr.dll!EEPolicy::HandleFatalError(unsigned int exitCode, unsigned int address, const wchar_t * pszMessage, _EXCEPTION_POINTERS * pExceptionInfo, const wchar_t * errorSource, const wchar_t * argExceptionString) Line 777 C++ > coreclr.dll!UnsafeJitFunction(PrepareCodeConfig * config, COR_ILMETHOD_DECODER * ILHeader, CORJIT_FLAGS flags, unsigned long *) Line 13173 C++ coreclr.dll!MethodDesc::JitCompileCodeLocked(PrepareCodeConfig * pConfig, ListLockEntryBase * pEntry, unsigned long * pFlags, CORJIT_FLAGS *) Line 1051 C++ coreclr.dll!MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig * pConfig, ListLockEntryBase * pEntry) Line 920 C++ coreclr.dll!MethodDesc::JitCompileCode(PrepareCodeConfig * pConfig) Line 860 C++ coreclr.dll!MethodDesc::PrepareILBasedCode(PrepareCodeConfig * pConfig) Line 439 C++ [Inline Frame] coreclr.dll!MethodDesc::PrepareCode(PrepareCodeConfig *) Line 332 C++ coreclr.dll!CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc * pMethodDesc, CallerGCMode callerGCMode, bool * doBackpatchRef, bool * doFullBackpatchRef) Line 1701 C++ coreclr.dll!MethodDesc::DoPrestub(MethodTable * pDispatchingMT, CallerGCMode callerGCMode) Line 2215 C++ coreclr.dll!ECall::PopulateManagedCastHelpers() Line 173 C++ coreclr.dll!SystemDomain::LoadBaseSystemClasses() Line 1486 C++ coreclr.dll!SystemDomain::Init() Line 1274 C++ coreclr.dll!EEStartupHelper() Line 998 C++ coreclr.dll!EEStartup() Line 1162 C++ coreclr.dll!EnsureEEStarted() Line 322 C++ coreclr.dll!CorHost2::Start() Line 102 C++ coreclr.dll!coreclr_initialize(const char * exePath, const char * appDomainFriendlyName, int propertyCount, const char * * propertyKeys, const char * * propertyValues, void * * hostHandle, unsigned int * domainId) Line 251 C++ hostpolicy.dll!coreclr_t::create(const std::wstring & libcoreclr_path, const char * exe_path, const char * app_domain_friendly_name, const coreclr_property_bag_t & properties, std::unique_ptr> & inst) Line 58 C++ hostpolicy.dll!`anonymous namespace'::create_coreclr() Line 81 C++ hostpolicy.dll!corehost_main(const int argc, const wchar_t * * argv) Line 426 C++ hostfxr.dll!execute_app(const std::wstring & impl_dll_dir, corehost_init_t * init, const int argc, const wchar_t * * argv) Line 147 C++ hostfxr.dll!`anonymous namespace'::read_config_and_execute(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map>,known_options_hash,std::equal_to,std::allocator>>>> & opts, int new_argc, const wchar_t * * new_argv, host_mode_t mode, const bool is_sdk_command, wchar_t * out_buffer, int buffer_size, int * required_buffer_size) Line 533 C++ hostfxr.dll!fx_muxer_t::handle_exec_host_command(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map>,known_options_hash,std::equal_to,std::allocator>>>> & opts, int argc, const wchar_t * * argv, int argoff, host_mode_t mode, const bool is_sdk_command, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 1018 C++ hostfxr.dll!fx_muxer_t::execute(const std::wstring host_command, const int argc, const wchar_t * * argv, const host_startup_info_t & host_info, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 594 C++ hostfxr.dll!hostfxr_main_startupinfo(const int argc, const wchar_t * * argv, const wchar_t * host_path, const wchar_t * dotnet_root, const wchar_t * app_path) Line 61 C++ CWAInstaller.exe!005aeada() Unknown [Frames below may be incorrect and/or missing, no symbols loaded for CWAInstaller.exe] CWAInstaller.exe!005aee1a() Unknown CWAInstaller.exe!005aff4c() Unknown kernel32.dll!@BaseThreadInitThunk@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ### Reproduction Steps while launching the application. ### Expected behavior This shouldn't crash. ### Actual behavior Its crashing with above given call stack. ### Regression? NA ### Known Workarounds NA ### Configuration _No response_ ### Other information _No response_
Author: Kundanbharti
Assignees: -
Labels: `area-CodeGen-coreclr`, `untriaged`
Milestone: -
elinor-fung commented 1 year ago

Do you have a repro application or dump you could share?

There is no indication on why it has failed but it does fail when CLR has been uninitialized or the runtime binaries are not installed or corrupted

How are you getting into an uninitialized or corrupted state?

ghost commented 1 year ago

This issue has been marked needs-author-action and may be missing some important information.

JulieLeeMSFT commented 1 year ago

@Kundanbharti, could you please answer the question from elinor-fung?

Do you have a repro application or dump you could share?

There is no indication on why it has failed but it does fail when CLR has been uninitialized or the runtime binaries are not installed or corrupted

How are you getting into an uninitialized or corrupted state?

JulieLeeMSFT commented 1 year ago

It seems like a VM related. Moving to VM. CC @mangod9.

Kundanbharti commented 1 year ago

Dump link : https://drive.google.com/file/d/1c84t5f8NAMqBk5PlFf0duRr3iCPfCBhw/view?usp=drive_link . Please let me know if this is inaccessible.