Crashes in `_mi_page_free_collect`

Offen
#1,496 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
c, rust
Bereich
backend

Rechercherichtung

Start by comparing the _mi_page_free_collect paths in src/page.c for v3.3.2 and src/alloc/page.c for v3.6.1, then inspect the allocator state at the reported crash locations. The report has no reproducer, so first try to narrow down a reproducible case on Rust and Windows; done means identifying the cause and a way to verify a fix.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

When using mimalloc in Rust on Windows, we've been experiencing rare crashes (1 out of 2000 runs approximately). We did not find a repro case yet.

We first noticed the issue in v3.3.2, then bumped from the no-longer-maintained mimalloc crate to the new in-repo bindings in v3.6.1, but the crashes still occur.

We've been hunting for a possible FFI mishap / wrong memory handling in the rest of the app but did not find anything yet so we're submitting this issue to collect feedback.

The problem seems similar to https://github.com/microsoft/mimalloc/issues/1098.

We've also tried compiling with MI_DEBUG=2 MI_SECURE=4 and running with GFlags "standard heap verification".

Partial backtrace using `v3.3.2`

This one points to https://github.com/microsoft/mimalloc/blob/v3.3.2/src/page.c#L178

0x172872a _mi_page_free_collect(mi_page_s*, bool)+54 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:210
0x173313e mi_page_queue_find_free_ex(mi_theap_s*, mi_page_queue_s*, bool)+9 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:765
0x172708f _mi_malloc_generic(mi_theap_s*, unsigned long long, unsigned long long, unsigned long long*)+13 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:1012
0x1735109 mi_theap_realloc_aligned(mi_theap_s*, void*, unsigned long long, unsigned long long)+231 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\alloc-aligned.c:368
0x17385ca alloc::raw_vec::RawVecInner<alloc::alloc::Global>::finish_grow<alloc::alloc::Global>(unsigned long long, core::alloc::layout::Layout)+13 C:\Users\user\.rustup\toolchains\nightly-2026-05-19-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc\src\raw_vec\mod.rs:556
0x173c47f alloc::raw_vec::RawVec<backtrace::capture::BacktraceFrame,alloc::alloc::Global>::grow_one<backtrace::capture::BacktraceFrame,alloc::alloc::Global>()+54 C:\Users\user\.rustup\toolchains\nightly-2026-05-19-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc\src\raw_vec\mod.rs:188
0x163c2f hickory_proto::rr::domain::name::Name::trim_to(unsigned long long)+723 C:\project\vendor\hickory-proto\src\rr\domain\name.rs:370
// snip
Partial backtrace using `v3.6.1`

Points to https://github.com/microsoft/mimalloc/blob/v3.6.1/src/alloc/page.c#L361

0x177e934 _mi_page_free_collect(mi_page_s*, bool)+48 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\page.c:384
0x178c990 mi_page_queue_find_free_ex(mi_theap_s*, mi_page_queue_s*, bool)+9 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:74
0x178c8da mi_page_queue_find_free(mi_theap_s*, mi_page_queue_s*)+7 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:211
0x177ccbb _mi_malloc_generic(mi_theap_s*, unsigned long long, unsigned long long, mi_page_s**)+10 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:494
0x162184a tracing_appender::non_blocking::impl$3::write(tracing_appender::non_blocking::NonBlocking*, ref$<slice2$<u8> >)+23 C:\project\vendor\tracing-appender\src\non_blocking.rs:242
// snip
Vorherrschende Sprache
C
Sterne
13.6k
Forks
1.2k
Ø Merge
18 Std. 12 Min.
Gemergte PRs (30 T.)
20

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/mimalloc

Alle Issues in microsoft/mimalloc

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.