In rust build, PkgBase armv7 in armv7 poudriere jail on aarch64: jemalloc's arena_choose_impl got Failed assertion: "ret" (arena_choose_hard result)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 04 Mar 2024 03:25:30 UTC
The context for this is messy and the failure happened after hours of high load average
bulk build activity. 32 GiBytes RAM with 118 GiBytes of swap (so: RAM+SWAP == 150 GiBytes).
8 cores (4 cortex-A78C and 4 cortex-X1C). Windows Dev Kit 2023. llvm18 was also building.
(Note: https://pkg.freebsd.org/FreeBSD:15:armv7/base_latest/ last updated over a month ago:
2024-Jan-25 09:48 UTC most recent file timestamps.) The aarch64 world in use to do the
bulk run was via a chroot into a directory tree not matching the boot world. (The boot
world was a more recent PkgBase aarch64 world, explaining the /home/bapt/worktrees/ in the
path in the message.)

<jemalloc>: /home/bapt/worktrees/main/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_b.h:23: Failed assertion: "ret"

/* Choose an arena based on a per-thread value. */
static inline arena_t *
arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal) {
        arena_t *ret;

        if (arena != NULL) {
                return arena;
        }

        /* During reentrancy, arena 0 is the safest bet. */
        if (unlikely(tsd_reentrancy_level_get(tsd) > 0)) {
                return arena_get(tsd_tsdn(tsd), 0, true);
        }

        ret = internal ? tsd_iarena_get(tsd) : tsd_arena_get(tsd);
        if (unlikely(ret == NULL)) {
                ret = arena_choose_hard(tsd, internal);
                assert(ret);
. . .

For reference:

. . .
[main-armv7-default] [2024-03-03_12h08m11s] [parallel_build] Queued: 265 Built: 255 Failed: 0   Skipped: 0   Ignored: 0   Fetched: 0   Tobuild: 10   Time: 06:29:58
 ID  TOTAL                  ORIGIN   PKGNAME          PHASE TIME     TMPFS       CPU% MEM%
[01] 04:32:52 devel/llvm18@default | llvm18-18.1.0.r3 build 04:26:27 8.58 GiB  432.9% 4.5%
[05] 04:32:52            lang/rust | rust-1.76.0      build 04:31:14 22.07 GiB 230.5% 3.1%
[06:30:02] Logs: /usr/local/poudriere/data/logs/bulk/main-armv7-default/2024-03-03_12h08m11s
[06:33:33] [05] [04:36:23] Finished lang/rust | rust-1.76.0: Failed: build
. . .

My monitoring got "Maximum observed" figures:
60015Mi MaxObs(Act+Wir+Lndry+SwapUsed)
56885Mi MaxObs(Act+Lndry+SwapUsed)
Swap: 29443Mi MaxObsUsed
31293Mi MaxObs(Act+Wir+Lndry)
3146Mi MaxObsWired
26712Mi MaxObsActive

(Sampled via a top variation.)

(Note: UFS file system, ZFS not loaded: no ARC.)

It is unlikely that I'll reproduce this failure, much less identify a
simpler context for reproducing it.


I do learn from this that PkgBase for armv7 has that assert enabled in
that code. (I do not know if that is typical or not.)

===
Mark Millard
marklmi at yahoo.com