Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201030001312.GW534@brightrain.aerifal.cx>
Date: Thu, 29 Oct 2020 20:13:12 -0400
From: Rich Felker <dalias@...c.org>
To: Milan P. Stanić <mps@...anta.net>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH v2] MT fork

On Thu, Oct 29, 2020 at 07:27:44PM -0400, Rich Felker wrote:
> On Fri, Oct 30, 2020 at 12:00:07AM +0100, Milan P. Stanić wrote:
> > On Thu, 2020-10-29 at 23:21, Szabolcs Nagy wrote:
> > > * Milan P. Stanić <mps@...anta.net> [2020-10-29 21:55:41 +0100]:
> > > > On Thu, 2020-10-29 at 17:13, Szabolcs Nagy wrote:
> > > > > * Milan P. Stanić <mps@...anta.net> [2020-10-29 00:06:10 +0100]:
> > > > > >  
> > > > > > Applied this patch on top of current musl master, build it on Alpine and
> > > > > > installed.
> > > > > > 
> > > > > > Tested by building ruby lang. Works fine.
> > > > > > Also tested building zig lang, works fine.
> > > > > > But crystal lang builds fine, but running it hangs. strace shows:
> > > > > > -------------
> > > > > > [pid  5573] futex(0x7efc50fba9e4, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
> > > > > > [pid  5568] futex(0x7efc5118f984, FUTEX_REQUEUE_PRIVATE, 0, 1, 0x7efc514b67a4) = 1
> > > > > > [pid  5568] futex(0x7efc514b67a4, FUTEX_WAKE_PRIVATE, 1) = 1
> > > > > > [pid  5571] <... futex resumed>)        = 0
> > > > > > [pid  5568] futex(0x7efc511099e4, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
> > > > > > [pid  5571] futex(0x7efc510409e4, FUTEX_WAIT_PRIVATE, 2, NULL
> > > > > > -------------
> > > > > > where it hangs.
> > > > > 
> > > > > try to attach gdb to the process that hang and do
> > > > > 
> > > > > thread apply all bt
> > > > > 
> > > > > (make sure musl-dbg is installed)
> > > > 
> > > > I cannot attach gdb for running process because my Alpine development
> > > > boxes are lxc containers where CAP_SYS_PTRACE is not enabled afaik.
> > > 
> > > there should be a way to config lxc to allow ptrace.
> > > 
> > > > I installed musl-dbg and run program with 'gdb .build/crystal' and result is:
> > > > ----------
> > > > Reading symbols from .build/crystal...
> > > > (gdb) run
> > > > Starting program: /home/mps/aports/community/crystal/src/crystal-0.35.1/.build/crystal
> > > > 
> > > > Program received signal SIGSEGV, Segmentation fault.
> > > 
> > > hm segfault is not a hang..
> > > 
> > > libgc tries to find stack bounds by registering a segfault handler
> > > and walking stack pages until it triggers.
> > > 
> > > gdb stops at signals, this one is harmless, you should just continue
> > > until you see a hang, then interrupt and bt.
> >  
> > I did continue now and stopped it when it hangs. Attached is gdb log
> > produced by 'thread apply all bt'
> 
> Next time please don't gzip so it's readable and repliable. I've
> expanded it out here though:
> 
> > Starting program: /home/mps/aports/community/crystal/src/crystal-0.35.1/.build/crystal 
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x00007ffff401c463 in GC_find_limit_with_bound () from /usr/lib/libgc.so.1
> > Continuing.
> > [New LWP 18867]
> > [New LWP 18868]
> > [New LWP 18869]
> > [New LWP 18870]
> > [New LWP 18871]
> > [New LWP 18872]
> > [New LWP 18873]
> > [New LWP 18874]
> > [New LWP 18875]
> > [New LWP 18876]
> > [New LWP 18877]
> > [New LWP 18878]
> > [New LWP 18879]
> > [New LWP 18880]
> > [New LWP 18881]
> > 
> > Thread 1 "crystal" received signal SIGINT, Interrupt.
> > __syscall_cp_c (nr=202, u=140737488349316, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > 61	./arch/x86_64/syscall_arch.h: No such file or directory.
> > 
> > Thread 16 (LWP 18881):
> > #0  __syscall_cp_c (nr=202, u=140737280690660, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff39f49e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff39f49e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3a04aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 15 (LWP 18880):
> > #0  __syscall_cp_c (nr=202, u=140737280965092, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3a379e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3a379e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3a47aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 14 (LWP 18879):
> > #0  __syscall_cp_c (nr=202, u=140737281239524, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3a7a9e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3a7a9e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3a8aaa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 13 (LWP 18878):
> > #0  __syscall_cp_c (nr=202, u=140737281513956, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3abd9e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3abd9e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3acdaa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 12 (LWP 18877):
> > #0  __syscall_cp_c (nr=202, u=140737281788388, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3b009e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3b009e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3b10aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 11 (LWP 18876):
> > #0  __syscall_cp_c (nr=202, u=140737282062820, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3b439e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3b439e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3b53aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 10 (LWP 18875):
> > #0  __syscall_cp_c (nr=202, u=140737282337252, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3b869e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3b869e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3b96aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 9 (LWP 18874):
> > #0  __syscall_cp_c (nr=202, u=140737282611684, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3bc99e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3bc99e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3bd9aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 8 (LWP 18873):
> > #0  __syscall_cp_c (nr=202, u=140737282886020, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3c0c984) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3c0c984, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40186ca in GC_mark_local () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40188f4 in GC_help_marker () from /usr/lib/libgc.so.1
> > #7  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #8  0x00007ffff7fb9df7 in start (p=0x7ffff3c1caa0) at src/thread/pthread_create.c:196
> > #9  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 7 (LWP 18872):
> > #0  __syscall_cp_c (nr=202, u=140737283160548, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3c4f9e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3c4f9e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3c5faa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 6 (LWP 18871):
> > #0  __syscall_cp_c (nr=202, u=140737283434980, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3c929e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3c929e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3ca2aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 5 (LWP 18870):
> > #0  __syscall_cp_c (nr=202, u=140737283709412, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3cd59e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3cd59e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3ce5aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 4 (LWP 18869):
> > #0  __syscall_cp_c (nr=202, u=140737283983844, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3d189e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3d189e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3d28aa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 3 (LWP 18868):
> > #0  __syscall_cp_c (nr=202, u=140737284258276, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3d5b9e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3d5b9e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3d6baa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 2 (LWP 18867):
> > #0  __syscall_cp_c (nr=202, u=140737284532708, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7ffff3d9e9e4) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7ffff3d9e9e4, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff40188b9 in GC_help_marker () from /usr/lib/libgc.so.1
> > #6  0x00007ffff40206db in GC_mark_thread () from /usr/lib/libgc.so.1
> > #7  0x00007ffff7fb9df7 in start (p=0x7ffff3daeaa0) at src/thread/pthread_create.c:196
> > #8  0x00007ffff7fbbf93 in __clone () at src/thread/x86_64/clone.s:22
> > Backtrace stopped: frame did not save the PC
> > 
> > Thread 1 (LWP 18859):
> > #0  __syscall_cp_c (nr=202, u=140737488349316, v=128, w=2, x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
> > #1  0x00007ffff7fb8937 in __futex4_cp (to=0x0, val=2, op=128, addr=0x7fffffffe884) at src/thread/__timedwait.c:52
> > #2  __timedwait_cp (addr=addr@...ry=0x7fffffffe884, val=val@...ry=2, clk=clk@...ry=0, at=at@...ry=0x0, priv=128, priv@...ry=1) at src/thread/__timedwait.c:52
> > #3  0x00007ffff7fb9740 in __pthread_cond_timedwait (c=0x7ffff403fba0, m=0x7ffff403f7a0, ts=0x0) at src/thread/pthread_cond_timedwait.c:100
> > #4  0x00007ffff40206fd in GC_wait_marker () from /usr/lib/libgc.so.1
> > #5  0x00007ffff4018852 in GC_do_parallel_mark () from /usr/lib/libgc.so.1
> > #6  0x00007ffff401937c in GC_mark_some () from /usr/lib/libgc.so.1
> > #7  0x00007ffff4010e5a in GC_stopped_mark () from /usr/lib/libgc.so.1
> > #8  0x00007ffff40114d4 in GC_try_to_collect_inner () from /usr/lib/libgc.so.1
> > #9  0x00007ffff401b47f in GC_init () from /usr/lib/libgc.so.1
> > #10 0x00005555555668d8 in init () at /home/mps/aports/community/crystal/src/crystal-0.35.1/src/gc/boehm.cr:127
> > #11 main () at /home/mps/aports/community/crystal/src/crystal-0.35.1/src/crystal/main.cr:35
> > #12 main () at /home/mps/aports/community/crystal/src/crystal-0.35.1/src/crystal/main.cr:114
> 
> OK, I'm looking at Boehm-GC's GC_wait_marker and this function is
> utterly bogus. It's using a condition variable without a predicate,
> and the corresponding broadcast operation runs without the lock held,
> so it's inherently subject both to spurious wakes and missed wakes.
> Here's the source:
> 
> https://github.com/ivmai/bdwgc/blob/57b97be07c514fcc4b608b13768fd2bf637a5899/pthread_support.c#L2374
> 
> This code is only used if built with PARALLEL_MARK defined, and
> obviously does not and cannot work, so I think the best solution is
> just figuring out how to turn off PARALLEL_MARK.
> 
> Do you have reason to believe the problem here has anything to do with
> the MT-fork patch? Was it maybe just hanging somewhere earlier without
> the patch, and now hanging on an independent bug?

Hmm, I'm not 100% sure anymore the above is correct. The caller of
GC_wait_marker, in:

https://github.com/ivmai/bdwgc/blob/57b97be07c514fcc4b608b13768fd2bf637a5899/mark.c#L1130

is calling it in a loop checking a condition. and can call
GC_notify_all_marker (the broadcast function) with the lock held.
There's another place where GC_notify_all_marker is called without the
lock held, but I don't see any problem there.

This definitely calls for more debugging, but turning off
PARALLEL_MARK might solve the problem for now. I do still want to know
if this has anything to do with fork; it sounds like not (or gdb would
have needed to be setup to follow fork).

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.