Repository navigation
Closed
Description
Summary
The Laravel example (examples/laravel-app, PR #564) dies on roughly one process start in three at its first Eloquent request (GET /api/notes): libmalloc aborts with a corrupted free list (SIGTRAP, exit 133). Every later request on a surviving process works.
Symptoms
libmalloctrap in_xzm_xzone_malloc_freelist_outlined, reached fromreallocin__mir_realloc_tagged(__mir_bt_frameson the firstdebug_backtrace, i.e. Laravel'swithoutRecursion), or from__mir_array_index_build. The site moves; the corruption exists before it.- The corrupted free-list word is a heap pointer with bit 62 set (
0x4000000000000000isMemoryAbi::DTOR_CALLED_MASK), so something writes a flag onto a block that has already been freed. - Rate about 1 in 3 starts at
-O 0,-O 1and-O 2; 0 of ~14 underlldb(ASLR off). With ASan it only shows as a quarantine-recycle CHECK failure; it disappears with ASan's quarantine off.
What was ruled out
- Double release of arrays, strings or objects (
MANTICORE_DEBUG_VERIFY=1stays silent). - Backtrace ring depth going negative (a trap on
popbelow zero never fired). - Pool or reference-box reuse (
MANTICORE_POOL_POISON,MANTICORE_REF_QUARANTINE). - Client timeouts or cancelled requests (fails with
wrk -c2 --timeout 60s, and on the first request). - Blocking-pool thread count (
MANTICORE_BLOCKING_THREADS1 / 4 / 64 fail 5/15, 1/15, 6/15). - The destructor registry (
__mir_dtor_*): withreg/unreg/ drop traced, all events are balanced. The only classes with destructors on this path are prelude ones:Resource,Fiber,Io\Poll\Context,__McPdoSqliteDrv,__McPdoSqliteStmt,WeakMap. - The cycle collector: no collection runs before the failing request (
MANTICORE_CC_TRACE; only ~2100 dead shells sit in the root buffer).
Not reproducible with instrumentation
Calling malloc_zone_check at boot phases (20 of 20 starts fine), verify mode, lldb and a changed code layout all make the failure disappear, so this looks like a layout- or timing-sensitive write to freed memory, not a deterministic ownership error.
Reproduce
cd examples/laravel-app && composer install && cp .env.example .env && php artisan key:generate && touch database/database.sqlite && php artisan migrate
php aot/compile-views.php && manticore build -O 2
for i in $(seq 12); do WORKERS=00 ./bin/app & sleep 8; curl -s -o /dev/null -w '%{http_code}\n' localhost:8181/api/notes; kill -9 %1; done # some print 000
Next
MallocStackLogging=1 + malloc_history on the corrupted block of a failing process, to name the allocation that was freed and still written.
Activity
examples/laravel-app: document the intermittent first-request abort (#…
examples/laravel-app: document the fiber stack (the cause of the #568 …
Laravel application compiles into a native binary and serves requests (…
blacktrs commentedon Nov 9, 2026
Fixed in #564: fiber stacks of 1 MiB with stack probes and a named overflow (root cause was a fiber stack overflow past the guard page). Checked on the 0.18.0 branch (#605): 12 of 12 cold starts of examples/laravel-app served the first
/api/noteswith 200 (the report saw ~1 in 3 abort).