microsoft / microsoft/mimalloc

Crash on Windows Server 2019 using Mimalloc v2.0.6

Open
#623 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

Hello!
We recently started testing mimalloc v2.0.6 in our project and ran into an issue on Windows Server 2019. However, we don't have any issues on Win10/11. On startup we have a crash:

> Faulting application name: launcher.exe, version: 0.0.0.0, time stamp: 0x632c2d38
> Faulting module name: ucrtbase.dll, version: 10.0.17763.719, time stamp: 0x48ac8393
> Exception code: 0xc0000409
> Fault offset: 0x000000000006e77e
> Faulting process id: 0xebc
> Faulting application start time: 0x01d8ce7793646e97
> Faulting application path: D:\bin\launcher.exe
> Faulting module path: C:\windows\System32\ucrtbase.dll
> Report Id: d62340f4-1b35-4f85-a29b-34ed8fccdff8
> Faulting package full name:
> Faulting package-relative application ID:
>

![image](https://user-images.githubusercontent.com/4595577/191733191-40398a67-1244-4475-8da6-86de9c013c72.png)

Here is a callstack:

> ntdll.dll!RtlReportFatalFailure() Unknown
> ntdll.dll!RtlReportCriticalFailure() Unknown
> ntdll.dll!RtlpHeapHandleError() Unknown
> ntdll.dll!RtlpHpHeapHandleError() Unknown
> ntdll.dll!RtlpLogHeapFailure() Unknown
> ntdll.dll!RtlFreeHeap() Unknown
> ucrtbase.dll!_free_base() Unknown
> [Inline Frame] rttr_core.dll!std::_Deallocate(void * _Ptr, unsigned __int64 _Bytes) Line 255 C++
> [Inline Frame] rttr_core.dll!std::allocator::deallocate(unsigned int * const) Line 830 C++
> [Inline Frame] rttr_core.dll!std::vector>::_Tidy() Line 1893 C++
> [Inline Frame] rttr_core.dll!std::vector>::{dtor}() Line 791 C++
> [Inline Frame] rttr_core.dll!std::_Vb_val>::{dtor}() Line 2658 C++
> [Inline Frame] rttr_core.dll!std::vector>::{dtor}() Line 2837 C++
> rttr_core.dll!rttr::detail::constructor_wrapper_base::create_signature_string() Line 95 C++
> rttr_core.dll!rttr::detail::constructor_wrapper_base::init() Line 58 C++
> [Inline Frame] core.dll!rttr::detail::constructor_wrapper,rttr::detail::parameter_infos,rttr::detail::parameter_info_wrapper>,rttr::type_list<>,float,float>::{ctor}(std::array) Line 88 C++
> [Inline Frame] core.dll!rttr::detail::make_unique(std::array &&) Line 276 C++
> core.dll!rttr::registration::bind,float,float>::create_constructor_wrapper,rttr::detail::parameter_info_wrapper>(std::array metadata_list, rttr::detail::default_args<> def_args, rttr::detail::parameter_infos,rttr::detail::parameter_info_wrapper> param_infos) Line 133 C++
> [Inline Frame] core.dll!rttr::registration::bind,float,float>::operator()(const rttr::detail::as_object &) Line 202 C++
> core.dll!engine::rttr_auto_register_reflection_function_() Line 106 C++
> ucrtbase.dll!_initterm() Unknown
> core.dll!dllmain_crt_process_attach(HINSTANCE__ * const instance, void * const reserved) Line 66 C++
> core.dll!dllmain_dispatch(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 276 C++
> ntdll.dll!LdrpCallInitRoutine() Unknown
> ntdll.dll!LdrpInitializeNode() Unknown
> ntdll.dll!LdrpInitializeGraphRecurse() Unknown
> ntdll.dll!LdrpInitializeGraphRecurse() Unknown
> ntdll.dll!LdrpInitializeGraphRecurse() Unknown
> ntdll.dll!LdrpInitializeGraphRecurse() Unknown
> ntdll.dll!LdrpInitializeGraphRecurse() Unknown
> ntdll.dll!LdrpInitializeProcess() Unknown
> ntdll.dll!_LdrpInitialize() Unknown
> ntdll.dll!LdrpInitialize() Unknown
> ntdll.dll!LdrInitializeThunk() Unknown

I have already tried the fixes suggested in https://github.com/microsoft/mimalloc/issues/521 and in https://github.com/microsoft/mimalloc/issues/103. Such as link directly with mimalloc-redirect.lib and use /INCLUDE:mi_redirect_enable. As well as apply minject.exe after. These steps did not help.

I think the problem is with ucrtbase.dll. We are using version 10.0.17763.719.

PS. I didn't find the source code for malloc-redirect. Could you provide it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce startup on Windows Server 2019 with mimalloc v2.0.6, then inspect the reported rttr::detail::constructor_wrapper_base::create_signature_string path and core.dll initialization around dllmain_crt_process_attach. Compare the behavior with the attempted mimalloc redirect fixes; done means the crash cause and a compatible fix or the requested malloc-redirect source are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.