microsoft / microsoft/mimalloc

mi_heap_try_new: throw and SIGABORT(6)

Open
#1,003 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

OS : CentOS 7
mimalloc version : v2.1.2
Ram : 128G
Process Virtual memory at the time of occurrence : 80G
Process physical memory at the time of occurrence : 22G
Problems :

  1. When physical memory is using about 50% of virtual memory, virtual memory is continuously increased.
  2. When virtual memory increased to about 80G, physical memory tended to stabilize.
    ex)
    VmSize 51357 mb VmRSS 17572 mb
    VmSize 51357 mb VmRSS 17605 mb
    VmSize 51357 mb VmRSS 17667 mb
    VmSize 51357 mb VmRSS 17703 mb
    VmSize 51357 mb VmRSS 17689 mb
    VmSize 51357 mb VmRSS 17707 mb
    VmSize 51357 mb VmRSS 17744 mb
    VmSize 51357 mb VmRSS 17778 mb
    VmSize 51357 mb VmRSS 17826 mb
    VmSize 51357 mb VmRSS 17846 mb
    VmSize 51357 mb VmRSS 17858 mb
    ...
    VmSize 51357 mb VmRSS 28963 mb
    VmSize 51357 mb VmRSS 28950 mb
    VmSize 51357 mb VmRSS 28916 mb
    VmSize 59549 mb VmRSS 49660 mb
    VmSize 80029 mb VmRSS 69506 mb
    VmSize 80029 mb VmRSS 57715 mb
    VmSize 80029 mb VmRSS 39002 mb
    VmSize 80029 mb VmRSS 37487 mb
    VmSize 80029 mb VmRSS 36094 mb
    VmSize 80029 mb VmRSS 34949 mb
    VmSize 80029 mb VmRSS 33972 mb
  3. As shown above, when the virtual memory is sufficiently increased, SIGABORT occurs due to the following call stack.

case 1. Occurs when constructing a std::string using boost::str and boost::format.
#0 0x00007f7183b96ba5: __nanosleep [libc-2.29.so]
#1 0x00007f7183b96aaa: sleep [libc-2.29.so]
#2 0x000000000043d043: crash_handler(int, siginfo_t*, void*) [myProcess]
#3 0x00007f7184746190: __restore_rt [libpthread.so.0]
#4 0x00007f7183b09531: raise [libc-2.29.so]
#5 0x00007f7183af4975: abort [libc-2.29.so]
#6 0x00007f7184274647: __gnu_cxx::__verbose_terminate_handler() [clone .cold] [libstdc++.so.6]
#7 0x00007f718427fe86: __cxxabiv1::__terminate(void ()()) [libstdc++.so.6]
#8 0x00007f718427fed1: std::terminate() [libstdc++.so.6]
#9 0x00007f7184280104: __cxa_throw [libstdc++.so.6]
#10 0x00007f7184f288ab: mi_heap_try_new(mi_heap_s
, unsigned long, bool) [libmimalloc.so.2]
#11 0x000000000044e9ed: boost::basic_format<char, std::char_traits, std::allocator >::basic_format(char const*) [myProcess]

case 2. Occurs in the process of passing the begin and end of std::string to the std::ostream buffer.
#0 0x00007faa1ebb6ba5: __nanosleep [libc-2.29.so]
#1 0x00007faa1ebb6aaa: sleep [libc-2.29.so]
#2 0x000000000043d043: crash_handler(int, siginfo_t*, void*) [myProcess]
#3 0x00007faa1f766190: __restore_rt [libpthread.so.0]
#4 0x00007faa1eb29531: raise [libc-2.29.so]
#5 0x00007faa1eb14975: abort [libc-2.29.so]
#6 0x00007faa1f294647: __gnu_cxx::__verbose_terminate_handler() [clone .cold] [libstdc++.so.6]
#7 0x00007faa1f29fe86: __cxxabiv1::__terminate(void ()()) [libstdc++.so.6]
#8 0x00007faa1f29fed1: std::terminate() [libstdc++.so.6]
#9 0x00007faa1f2a0104: __cxa_throw [libstdc++.so.6]
#10 0x00007faa1ff488ab: mi_heap_try_new(mi_heap_s
, unsigned long, bool) [libmimalloc.so.2]
#11 0x00007faa1f332ddc: std::__cxx11::basic_string<char, std::char_traits, std::allocator >::reserve(unsigned long) [libstdc++.so.6]

==> What they have in common is that an exception occurred in the process of allocating heap memory space through mimalloc.

Do you know the cause and solution?

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

Start at the mi_heap_try_new entry point and compare the two reported std::string allocation call stacks on CentOS 7 with mimalloc v2.1.2. Investigate the reported virtual-memory and physical-memory behavior, then establish a reproducible cause and document or implement a verified solution for the allocation exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.