Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 947005

Summary: dev-libs/jemalloc[debug]: failed assertion (in tests) w/ sys-devel/gcc:15 (dev-util/ruff-0.8.4 fails to compile: environment: line 2497: 4264 Aborted ruff generate-shell-completion bash > ruff-completion.bash)
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: chutzpah, eschwartz, kumba
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/jemalloc/jemalloc/pull/2704
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118138
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118097
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118535
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 932474    
Attachments: build.log
jemalloc-5.3.0-r1:20250102-093528.log

Description Agostino Sarubbo gentoo-dev 2024-12-27 08:51:50 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-util/ruff-0.8.4 fails to compile.
Discovered on: amd64 (internal ref: gcc15_tinderbox)
System: GCC-15-SYSTEM (https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#GCC-15)

Info about the issue:
https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0014
Comment 1 Agostino Sarubbo gentoo-dev 2024-12-27 08:51:51 UTC
Created attachment 915221 [details]
build.log

build log and emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 08:53:12 UTC
```

<jemalloc>: /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/atomic_gcc_atomic.h:31: Unreachable code reached
/var/tmp/portage/dev-util/ruff-0.8.4/temp/environment: line 2497:  4264 Aborted                 ${releasedir}/ruff generate-shell-completion bash > ruff-completion.bash
```

jemalloc miscompiled?

ago, does jemalloc pass its testsuite for you?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 09:00:57 UTC
I get some jemalloc test failures with GCC 15, but -fno-malloc-dce fixes those.

https://github.com/jemalloc/jemalloc/pull/2704 would fix that, I think. But I think this is unrelated to the issue you've hit.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 09:09:35 UTC
With USE=debug on jemalloc, I get this in the testsuite, yay:
```
=== test/integration/aligned_alloc ===
<jemalloc>: /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/atomic_gcc_atomic.h:31: Unreachable code reached
Aborted (core dumped)
Test harness error: test/integration/aligned_alloc w/ MALLOC_CONF=""
Use prefix to debug, e.g. JEMALLOC_TEST_PREFIX="gdb --args" sh test/test.sh test/integration/aligned_alloc
make: *** [Makefile:683: check_integration] Error 1
make: *** Waiting for unfinished jobs....
```
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 09:21:14 UTC
It only happens with GCC 15, it happens even with -fno-malloc-dce, and -std=gnu17 doesn't help either (wasn't sure if something was getting confused by the ATOMIC_VAR_INIT removal somehow).
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 09:32:39 UTC
```
Starting program: /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0-abi_x86_64.amd64/test/integration/aligned_alloc /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/ /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0-abi_x86_64.amd64/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
44	      return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:89
#3  0x00007ffff7620832 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7603832 in __GI_abort () at abort.c:79
#5  0x00007ffff7c51801 in atomic_enum_to_builtin (mo=4294967294) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/atomic_gcc_atomic.h:31
#6  atomic_enum_to_builtin (mo=4294967294) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/atomic_gcc_atomic.h:17
#7  atomic_load_p (mo=4294967294, a=<optimized out>) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/atomic.h:83
#8  rtree_leaf_elm_bits_read (tsdn=<optimized out>, rtree=<optimized out>, elm=<optimized out>, dependent=true) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/rtree.h:182
#9  rtree_leaf_elm_read (dependent=true, tsdn=0x7ffff7bfd738, rtree=<optimized out>, elm=<optimized out>) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/rtree.h:242
#10 emap_edata_is_acquired (tsdn=tsdn@entry=0x7ffff7bfd738, emap=<optimized out>, edata=edata@entry=0x7ffff7417380) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/emap.h:193
#11 0x00007ffff7c5297f in extent_split_impl (tsdn=0x7ffff7bfd738, pac=0x7ffff7403c08, ehooks=0x7ffff74000c0, edata=0x7ffff7417380, size_a=size_a@entry=32768, size_b=size_b@entry=2064384, holding_core_locks=true) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/extent.c:1213
#12 0x00007ffff7c52d6e in extent_split_interior (tsdn=tsdn@entry=0x7ffff7bfd738, pac=pac@entry=0x7ffff7403c08, ehooks=ehooks@entry=0x7ffff74000c0, edata=edata@entry=0x7fffffffdb70, lead=lead@entry=0x7fffffffdb78, trail=trail@entry=0x7fffffffdb80, to_leak=0x7fffffffdb88, to_salvage=0x7fffffffdb90, expand_edata=0x0, size=32768, alignment=4096) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/extent.c:511
#13 0x00007ffff7c56d9c in extent_grow_retained (tsdn=<optimized out>, pac=0x7ffff7403c08, ehooks=0x7ffff74000c0, size=32768, alignment=4096, zero=true, commit=0x7fffffffdb6d) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/extent.c:699
#14 extent_alloc_retained (tsdn=<optimized out>, pac=0x7ffff7403c08, ehooks=0x7ffff74000c0, expand_edata=0x0, size=32768, alignment=4096, zero=true, commit=0x7fffffffdb6d, guarded=false) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/extent.c:791
#15 je_ecache_alloc_grow (tsdn=0x7ffff7bfd738, pac=pac@entry=0x7ffff7403c08, ehooks=0x7ffff74000c0, ecache=ecache@entry=0x7ffff740d4b0, expand_edata=expand_edata@entry=0x0, size=size@entry=32768, alignment=4096, zero=true, guarded=false) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/extent.c:104
#16 0x00007ffff7c654da in pac_alloc_real (tsdn=tsdn@entry=0x7ffff7bfd738, pac=pac@entry=0x7ffff7403c08, ehooks=ehooks@entry=0x7ffff74000c0, size=size@entry=32768, alignment=alignment@entry=4096, zero=zero@entry=true, guarded=false) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/pac.c:124
#17 0x00007ffff7c657cc in pac_alloc_impl (tsdn=0x7ffff7bfd738, self=0x7ffff7403c08, size=32768, alignment=4096, zero=<optimized out>, guarded=<optimized out>, frequent_reuse=false, deferred_work_generated=0x7fffffffdd5f) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/pac.c:178
#18 0x00007ffff7c63fea in pai_alloc (tsdn=0x7ffff7bfd738, self=0x7ffff7403c08, size=32768, alignment=<optimized out>, zero=true, guarded=<optimized out>, frequent_reuse=false, deferred_work_generated=0x7fffffffdd5f) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/pai.h:43
#19 je_pa_alloc (tsdn=tsdn@entry=0x7ffff7bfd738, shard=shard@entry=0x7ffff7403bf0, size=32768, alignment=alignment@entry=4096, slab=slab@entry=false, szind=szind@entry=39, zero=true, guarded=false, deferred_work_generated=0x7fffffffdd5f) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/pa.c:139
#20 0x00007ffff7c2edeb in je_arena_extent_alloc_large (tsdn=tsdn@entry=0x7ffff7bfd738, arena=arena@entry=0x7ffff7401100, usize=<optimized out>, alignment=4096, zero=true) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/arena.c:338
#21 0x00007ffff7c5ff73 in je_large_palloc (tsdn=0x7ffff7bfd738, arena=<optimized out>, usize=<optimized out>, alignment=<optimized out>, zero=<optimized out>) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/large.c:37
#22 0x00007ffff7c75fb0 in ipallocztm (tsdn=tsdn@entry=0x7ffff7bfd738, usize=28672, alignment=alignment@entry=4096, arena=0x7ffff7401100, is_internal=true, tcache=0x0, zero=true) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/jemalloc_internal_inlines_c.h:80
#23 0x00007ffff7c77907 in je_tsd_tcache_data_init (tsd=0x7ffff7bfd738) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/jemalloc_internal_inlines_a.h:71
#24 0x00007ffff7c77ac5 in je_tsd_tcache_enabled_data_init (tsd=tsd@entry=0x7ffff7bfd738) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/tcache.c:644
#25 0x00007ffff7c79f00 in tsd_data_init (tsd=tsd@entry=0x7ffff7bfd738) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/tsd.c:244
#26 0x00007ffff7c7ac0e in je_tsd_fetch_slow (tsd=0x7ffff7bfd738, minimal=minimal@entry=false) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/tsd.c:311
#27 0x00007ffff7c7ad94 in tsd_fetch_impl (init=true, minimal=false) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/include/jemalloc/internal/tsd.h:422
#28 0x00007ffff7c265f1 in malloc_init_hard () at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/jemalloc.c:2135
#29 0x00007ffff7c2859a in malloc_init () at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/jemalloc.c:298
#30 imalloc_init_check (sopts=0x7fffffffdf80, dopts=0x7fffffffdfb0) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/jemalloc.c:2658
#31 imalloc (sopts=0x7fffffffdf80, dopts=0x7fffffffdfb0) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/jemalloc.c:2689
#32 je_malloc_default (size=73728) at /var/tmp/portage/dev-libs/jemalloc-5.3.0-r1/work/jemalloc-5.3.0/src/jemalloc.c:2722
#33 0x00007ffff781d42e in (anonymous namespace)::pool::pool (this=0x7ffff7acb240 <(anonymous namespace)::emergency_pool>) at /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/libstdc++-v3/libsupc++/eh_alloc.cc:235
#34 __static_initialization_and_destruction_0 () at /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/libstdc++-v3/libsupc++/eh_alloc.cc:373
#35 _GLOBAL__sub_I_eh_alloc.cc(void) () at /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/libstdc++-v3/libsupc++/eh_alloc.cc:456
#36 0x00007ffff7fc9ade in call_init (l=<optimized out>, argc=argc@entry=3, argv=argv@entry=0x7fffffffe148, env=env@entry=0x7fffffffe168) at dl-init.c:74
#37 0x00007ffff7fc9be3 in call_init (l=<optimized out>, argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at dl-init.c:120
#38 _dl_init (main_map=0x7ffff7ffe2e0, argc=3, argv=0x7fffffffe148, env=0x7fffffffe168) at dl-init.c:121
#39 0x00007ffff7fe4db0 in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#40 0x0000000000000003 in ?? ()
#41 0x00007fffffffe3e7 in ?? ()
#42 0x00007fffffffe457 in ?? ()
#43 0x00007fffffffe498 in ?? ()
#44 0x0000000000000000 in ?? ()
```
Comment 8 Larry the Git Cow gentoo-dev 2024-12-27 11:43:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00098905947bf63e40dcf83b55ffa226156994e5

commit 00098905947bf63e40dcf83b55ffa226156994e5
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-12-27 09:25:56 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-12-27 11:42:46 +0000

    dev-libs/mimalloc: add USE=debug
    
    Inspired by bug #947005.
    
    Bug: https://bugs.gentoo.org/947005
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/mimalloc/mimalloc-2.1.7.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 11:49:03 UTC
OK, I think it's the same as the other ipa-cp issues (https://gcc.gnu.org/PR118138).
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-27 11:49:15 UTC
(In reply to Sam James from comment #9)
> OK, I think it's the same as the other ipa-cp issues
> (https://gcc.gnu.org/PR118138).

... and -fno-ipa-cp is a workaround.
Comment 11 Agostino Sarubbo gentoo-dev 2025-01-02 09:37:37 UTC
(In reply to Sam James from comment #2)
> ago, does jemalloc pass its testsuite for you?

it doesn't. I'm attaching the build.log for completeness
Comment 12 Agostino Sarubbo gentoo-dev 2025-01-02 09:37:43 UTC
Created attachment 915734 [details]
jemalloc-5.3.0-r1:20250102-093528.log

jemalloc-5.3.0-r1:20250102-093528.log
Comment 13 Larry the Git Cow gentoo-dev 2025-01-13 00:25:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1432e92aa0f6c92166acdbea673861d564fb972e

commit 1432e92aa0f6c92166acdbea673861d564fb972e
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-13 00:23:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-13 00:23:19 +0000

    sys-devel/gcc: add 15.0.0_pre20250112
    
    Closes: https://bugs.gentoo.org/947005
    Closes: https://bugs.gentoo.org/947016
    Closes: https://bugs.gentoo.org/946958
    Closes: https://bugs.gentoo.org/946900
    Closes: https://bugs.gentoo.org/946876
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                      |  2 ++
 sys-devel/gcc/gcc-15.0.0_pre20250112.ebuild | 53 +++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 18:10:42 UTC
*** Bug 948223 has been marked as a duplicate of this bug. ***
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 18:11:44 UTC
Reopening given bug 948223. There's some ipa-cp bugs lurking still:
* https://gcc.gnu.org/PR118097
* https://gcc.gnu.org/PR118535

I'm unlikely to spend time reducing jemalloc until those are fixed.
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-18 18:16:26 UTC
I can't seem to reproduce this anymore but ago hit it in a dupe (bug 948223) with 15.0.0_pre20250112-r2 and nothing has changed in ipa-cp.
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-18 18:21:06 UTC
Maybe jakub's r15-6566-g804e9d55d9e54c but I'd been testing with -fno-malloc-dce to avoid unrelated failures anyway.
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-18 19:00:50 UTC
OK, I've spent a while on this now, and I'm pretty sure it's fixed. ago, did you have a jemalloc binpkg in use perhaps for bug 948223?
Comment 19 Agostino Sarubbo gentoo-dev 2025-01-20 07:58:36 UTC
(In reply to Sam James from comment #18)
> OK, I've spent a while on this now, and I'm pretty sure it's fixed. ago, did
> you have a jemalloc binpkg in use perhaps for bug 948223?

by rebuiling jemalloc this is fixed, sorry for the noise