microsoft / microsoft/mimalloc
Segfault in `mi_arena_try_purge` upon exit, same use case as in #1313
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
I am developing my application that caused #1313 further. This stacktrace comes out when my application exists (v3):
```
0x0830fd1d in mi_arena_try_purge (arena=0x8740000, now=156588059, force=true) at src/3rdparty/mimalloc-main/src/arena.c:2226
2226 if (arena->memid.is_pinned) return -1;
#0 0x0830fd1d in mi_arena_try_purge (arena=0x8740000, now=156588059, force=true) at src/3rdparty/mimalloc-main/src/arena.c:2226
#1 0x08310950 in mi_arenas_try_purge (force=true, visit_all=true, subproc=0x87375c0 , tseq=0)
at src/3rdparty/mimalloc-main/src/arena.c:2281
#2 0x08306266 in _mi_arenas_collect (force_purge=true, visit_all=true, tld=0x85c9e40 )
at src/3rdparty/mimalloc-main/src/arena.c:1381
#3 0x0835e962 in mi_theap_collect_ex (theap=0x85c9ec0 , collect=MI_FORCE) at src/3rdparty/mimalloc-main/src/theap.c:142
#4 0x0835ea3a in mi_theap_collect (theap=0x85c9ec0 , force=true) at src/3rdparty/mimalloc-main/src/theap.c:153
#5 0x0832ebcf in mi_process_done_once () at src/3rdparty/mimalloc-main/src/init.c:1215
#6 0x0832ee5e in mi_process_done () at src/3rdparty/mimalloc-main/src/init.c:1251
#7 0x0832eeb4 in _mi_auto_process_done () at src/3rdparty/mimalloc-main/src/init.c:1257
#8 0x0836a120 in mi_process_detach () at src/3rdparty/mimalloc-main/src/prim/prim.c:45
#9 0xf7fc9682 in _dl_call_fini (closure_map=closure_map@entry=0xf7ffda60) at ./elf/dl-call_fini.c:43
#10 0xf7fcca45 in _dl_fini () at ./elf/dl-fini.c:120
#11 0xf6ce5401 in __run_exit_handlers (status=, status@entry=0, listp=, run_list_atexit=,
run_list_atexit@entry=true, run_dtors=, run_dtors@entry=true) at ./stdlib/exit.c:118
#12 0xf6ce5607 in __GI_exit (status=0) at ./stdlib/exit.c:148
#13 0xf6cca2a6 in __libc_start_call_main (main=main@entry=0x804d55d <_start+45>, argc=argc@entry=1, argv=argv@entry=0xffffccd4)
at ../sysdeps/nptl/libc_start_call_main.h:74
#14 0xf6cca363 in __libc_start_main_impl (main=0x804d55d <_start+45>, argc=1, argv=0xffffccd4, init=0x0, fini=0x0,
rtld_fini=0xf7fcc820 <_dl_fini>, stack_end=0xffffcccc) at ../csu/libc-start.c:360
#15 0x0804d558 in _start () at ../sysdeps/i386/start.S:110
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing this report with issue #1313 and tracing the exit-time call chain from src/3rdparty/mimalloc-main/src/init.c through theap.c to arena.c:2226. Reproduce the application’s exit path and determine why mi_arena_try_purge reaches the failing access; done means the reported exit-time segfault is no longer reproducible and the relevant regression coverage passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100