[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jemalloc's Hurd patch



Hello,

Faidon Liambotis, le lun. 17 juil. 2023 00:24:42 +0300, a ecrit:
> On Tue, May 16, 2023 at 06:31:58PM +0300, Faidon Liambotis wrote:
> > On Tue, May 16, 2023 at 05:22:44PM +0200, Samuel Thibault wrote:
> > > For information, I have completed and submitted jemalloc's hurd.patch to
> > > https://github.com/jemalloc/jemalloc/pull/2443
> > 
> > That's awesome, thank you! I'll include it in the next upload, which
> > will be after the bookworm release at this point.
> 
> I got around to testing this, and I tried a test build with the updated
> patch, in a Hurd QEMU (20230608 nightly, dist-upgraded to today's
> unstable).
> 
> The aligned_alloc test fails, with "Killed". gdb says "Thread 4 received
> signal ?, Unknown signal." and has a backtrace involving...
>   __GI___pthread_mutex_lock ->
>   __GI___pthread_key_create ->
>   tsd_boot0 ->
>   je_malloc_tsd_boot0 ->
>   malloc_init_hard ->
>   malloc_init ->
>   ...
> 
> Have you ("make check" and/or dpkg-buildpackage) tested this change? Are
> you able to reproduce?

Never cut a backtrace :)

The full backtrace is:

#0  __GI___pthread_mutex_lock (mtxp=0x11181e0 <__pthread_key_lock>) at ../sysdeps/mach/hurd/htl/pt-mutex-lock.c:41
#1  0x0110ab1c in __GI___pthread_key_create (key=0x10f8e84 <je_tsd_tsd>, destructor=0x10c7140 <je_tsd_cleanup>) at ../sysdeps/htl/pt-key-create.c:42
#2  0x010c7673 in tsd_boot0 () at include/jemalloc/internal/tsd_tls.h:15
#3  je_malloc_tsd_boot0 () at src/tsd.c:459
#4  0x01052766 in malloc_init_hard () at src/jemalloc.c:2160
#5  0x0105563d in malloc_init () at src/jemalloc.c:301
#6  imalloc_init_check (dopts=<synthetic pointer>, sopts=<synthetic pointer>) at src/jemalloc.c:2643
#7  imalloc (dopts=<synthetic pointer>, sopts=<synthetic pointer>) at src/jemalloc.c:2674
#8  je_malloc_default (size=716) at src/jemalloc.c:2707
#9  0x01055ca0 in imalloc_fastpath (fallback_alloc=0x10550f0 <je_malloc_default>, size=<optimized out>) at include/jemalloc/internal/jemalloc_internal_inlines_c.h:277
#10 0x0110b3d5 in __pthread_alloc (pthread=0x1035c30) at ./htl/pt-alloc.c:114
#11 0x0110babc in __pthread_create_internal (thread=0x1035c78, attr=0x1035c7c, start_routine=0x0, arg=0x0) at ./htl/pt-create.c:114
#12 0x01110f2b in _init_routine (stack=<optimized out>) at ../sysdeps/mach/hurd/htl/pt-sysdep.c:64
#13 0x00006292 in call_init (env=0x1035d6c, argv=<optimized out>, argc=1, l=<optimized out>) at ./elf/dl-init.c:70
#14 call_init (l=<optimized out>, argc=1, argv=<optimized out>, env=0x1035d6c) at ./elf/dl-init.c:26
#15 0x000063ff in _dl_init (main_map=0x34a30, argc=1, argv=0x1035d64, env=0x1035d6c) at ./elf/dl-init.c:84
#16 0x0001c0d0 in _dl_start_user () from /lib/ld.so

I.e. while libpthread is initializing, it allocates a thread structure,
thus triggering the jemalloc initialization, which makes libpthread
calls, but libpthread is not finished initializing.

I had work pending to fix that, I have now done it, and will commit it.
With that done, the testsuite does pass indeed.

Samuel


Reply to: