From owner-freebsd-threads@freebsd.org Tue Aug 23 21:20:47 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0317BC4CF2 for ; Tue, 23 Aug 2016 21:20:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF7E71DD5 for ; Tue, 23 Aug 2016 21:20:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NLKlRJ024786 for ; Tue, 23 Aug 2016 21:20:47 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Tue, 23 Aug 2016 21:20:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: longwitz@incore.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 21:20:48 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 --- Comment #2 from longwitz@incore.de --- In the meantime I have extracted the pthread relevant parts of the program bconsole and can give a working program thrtest.c that demonstrates the problem: #include #include #include #include static int global_ct =3D 0; static pthread_mutex_t global_mutex =3D PTHREAD_MUTEX_INITIALIZER; static pthread_t work_thread; void register_thread() { pthread_mutex_lock(&global_mutex); ++global_ct; pthread_mutex_unlock(&global_mutex); } void unregister_thread() { pthread_mutex_lock(&global_mutex); --global_ct; pthread_mutex_unlock(&global_mutex); } void clean_handler(void *a) { unregister_thread(); } void *work_start(void *x) { register_thread(); pthread_cleanup_push(clean_handler, NULL); while (sleep(30)) getpid(); pthread_cleanup_pop(1); exit(global_ct); } void cleanup_main() { pthread_cancel(work_thread); unregister_thread(); pthread_mutex_lock(&global_mutex); getpid(); pthread_mutex_unlock(&global_mutex); } int main(int argc, char *argv[]) { register_thread(); pthread_create(&work_thread, NULL, work_start, NULL); getpid(); sleep(1); cleanup_main(); exit(global_ct); } The relevant parts of ktrace output starting with sleep(1) from main(): 83194 101055 thrtest 0.001482 CALL nanosleep(0x7fffdfffdf08,0x7fffdfffde= f8) 83194 100732 thrtest 1.043574 RET nanosleep 0 83194 100732 thrtest 1.043602 CALL thr_kill(0x18abf,SIG 32) 83194 100732 thrtest 1.043617 RET thr_kill 0 83194 101055 thrtest 1.043624 RET nanosleep -1 errno 4 Interrupted syst= em call 83194 100732 thrtest 1.043625 CALL getpid 83194 101055 thrtest 1.043640 PSIG SIG 32 caught handler=3D0x80082d080 mask=3D0x0 code=3DSI_LWP 83194 100732 thrtest 1.043657 RET getpid 83194/0x144fa 83194 101055 thrtest 1.043676 CALL thr_wake(0x18abf) 83194 101055 thrtest 1.043686 RET thr_wake 0 83194 101055 thrtest 1.043691 CALL thr_wake(0x18abf) 83194 101055 thrtest 1.043696 RET thr_wake 0 83194 101055 thrtest 1.043701 CALL sigreturn(0x7fffdfffda70) 83194 101055 thrtest 1.043708 RET sigreturn JUSTRETURN 83194 101055 thrtest 1.043716 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_RDLOCK,0,0,0) 83194 101055 thrtest 1.043723 RET _umtx_op 0 83194 100732 thrtest 1.043725 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_WRLOCK,0,0,0) 83194 101055 thrtest 1.043743 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_UNLOCK,0,0,0) 83194 101055 thrtest 1.043757 RET _umtx_op 0 83194 101055 thrtest 1.043762 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_UNLOCK,0,0,0) 83194 101055 thrtest 1.043767 RET _umtx_op 0 83194 101055 thrtest 1.043771 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_RDLOCK,0,0,0) 83194 100732 thrtest 1.043771 RET _umtx_op 0 83194 101055 thrtest 1.043779 RET _umtx_op -1 errno 4 Interrupted system call 83194 100732 thrtest 1.043781 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_UNLOCK,0,0,0) 83194 101055 thrtest 1.043785 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_RDLOCK,0,0,0) 83194 100732 thrtest 1.043789 RET _umtx_op 0 83194 101055 thrtest 1.043792 RET _umtx_op 0 83194 100732 thrtest 1.043797 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_WRLOCK,0,0,0) 83194 101055 thrtest 1.043800 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_UNLOCK,0,0,0) 83194 101055 thrtest 1.043805 RET _umtx_op 0 83194 101055 thrtest 1.043811 CALL=20 _umtx_op(0x800a42880,UMTX_OP_RW_UNLOCK,0,0,0) 83194 101055 thrtest 1.043813 RET _umtx_op 0 83194 101055 thrtest 1.043816 CALL thr_exit(0x801406800) Now the process 83194 hangs and procstat gives PID TID COMM TDNAME KSTACK 83194 100732 thrtest - mi_switch+0xe1 sleepq_catch_signals+0xab sleepq_wait_sig+0xf _sleep+0x27d umtxq_sleep+0x125 do_rw_wrlock+0x5af __umtx_op_rw_wrlock+0x47 amd64_syscall+0x40f Xfast_syscall+0xfb PID TID COMM TDNAME CPU PRI STATE WCHAN 83194 100732 thrtest - 1 122 sleep uwrlck Please can somebody verify this bug in FreeBSD 10.3 STABLE, my rev is 30163= 3. --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-threads@freebsd.org Wed Aug 24 09:02:27 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E421BC0C02 for ; Wed, 24 Aug 2016 09:02:27 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8342215DD for ; Wed, 24 Aug 2016 09:02:27 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O92QZg003559 for ; Wed, 24 Aug 2016 09:02:27 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Wed, 24 Aug 2016 09:02:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:02:27 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 Konstantin Belousov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kib@FreeBSD.org --- Comment #3 from Konstantin Belousov --- I can reproduce a hang with your test program with stable/10 libs on 11 ker= nel. On the other hand, I run your program in a loop for a hour on HEAD machine= and was not able to observe the hang. When the program hangs, I see that the only live thread waits for the rtld_bind_lock, which is declared as write locked. So it looks as if the cancelled thread leaked the rtld bind lock. It might be only appearance of= the leak, though. [Switching to LWP 101215 of process 54629] _umtx_op_err () at /usr/src/lib/libthr/arch/i386/i386/_umtx_op_err.S:36 36 SYSCALL_ERR(_umtx_op) (gdb) bt #0 _umtx_op_err () at /usr/src/lib/libthr/arch/i386/i386/_umtx_op_err.S:36 #1 0x2807fe01 in __thr_rwlock_wrlock (rwlock=3D0x0, tsp=3D) at /usr/src/lib/libthr/thread/thr_umtx.c:297 #2 0x280884c0 in _thr_rwlock_wrlock (rwlock=3D, tsp=3D) at /usr/src/lib/libthr/thread/thr_umtx.h:204 #3 _thr_rtld_wlock_acquire (lock=3D0x28097d00) at /usr/src/lib/libthr/thread/thr_rtld.c:141 #4 0x280539ff in wlock_acquire (lock=3D0x28063f58 , lockstate=3D0xffffd598) at /usr/src/libexec/rtld-elf/rtld_lock.c:217 #5 0x2804da23 in objlist_call_fini (list=3D, root=3D, lockstate=3D) at /usr/src/libexec/rtld-elf/rtld.c:2421 #6 0x2804cb7a in rtld_exit () at /usr/src/libexec/rtld-elf/rtld.c:2801 #7 0x281a68ab in __cxa_finalize (dso=3D) at /usr/src/lib/libc/stdlib/atexit.c:200 #8 0x28146f7f in exit (status=3D-10552) at /usr/src/lib/libc/stdlib/exit.c= :73 #9 0x080488f6 in main () at pr-211947.c:70 (gdb) frame 4 #4 0x280539ff in wlock_acquire (lock=3D0x28063f58 , lockstate=3D0xffffd598) at /usr/src/libexec/rtld-elf/rtld_lock.c:217 217 lockinfo.wlock_acquire(lock->handle); (gdb) p/x *(struct urwlock *)(lock->handle) $3 =3D {rw_state =3D 0xa0000000, rw_flags =3D 0x2, rw_blocked_readers =3D 0= x0, rw_blocked_writers =3D 0x0, rw_spare =3D {0x0, 0x0, 0x0, 0x0}} 0xa0000000 =3D=3D URWLOCK_WRITE_OWNER | URWLOCK_READ_WAITERS --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-threads@freebsd.org Wed Aug 24 19:54:52 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B083BC5777 for ; Wed, 24 Aug 2016 19:54:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 805A216C5 for ; Wed, 24 Aug 2016 19:54:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7OJsq5k021575 for ; Wed, 24 Aug 2016 19:54:52 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Wed, 24 Aug 2016 19:54:52 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: longwitz@incore.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 19:54:52 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 --- Comment #4 from longwitz@incore.de --- I can confirm that the user stack of the hanging process nearly looks like yours, the difference is probably because I use amd64: [Switching to Thread 801406400 (LWP 100956)] _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:37 37 RSYSCALL_ERR(_umtx_op) (gdb) bt #0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:= 37 #1 0x000000080082a267 in __thr_rwlock_wrlock (rwlock=3D0x800a42880, tsp=3D) at /usr/src/lib/libthr/thread/thr_umtx.c:297 #2 0x000000080083186a in _thr_rwlock_wrlock (rwlock=3D, tsp=3D) at /usr/src/lib/libthr/thread/thr_umtx.h:204 #3 _thr_rtld_wlock_acquire (lock=3D0x800a42880) at /usr/src/lib/libthr/thread/thr_rtld.c:141 #4 0x000000080060bc80 in wlock_acquire (lock=3D0x80081fcc0 , lockstate=3D0x7fffffffe658) at /usr/src/libexec/rtld-elf/rtld_lock.c:217 #5 0x0000000800605dbd in objlist_call_fini (list=3D, root=3D, lockstate=3D) at /usr/src/libexec/rtld-elf/rtld.c:2418 #6 0x0000000800604f39 in rtld_exit () at /usr/src/libexec/rtld-elf/rtld.c:= 2800 #7 0x0000000800b5f8c6 in __cxa_finalize () from /lib/libc.so.7 #8 0x0000000800b0337c in exit () from /lib/libc.so.7 #9 0x0000000000400bcb in main () (gdb) frame 4 #4 0x000000080060bc80 in wlock_acquire (lock=3D0x80081fcc0 , lockstate=3D0x7fffffffe658) at /usr/src/libexec/rtld-elf/rtld_lock.c:217 217 lockinfo.wlock_acquire(lock->handle); (gdb) p/x *(struct urwlock *)(lock->handle) $1 =3D {rw_state =3D 0xa0000000, rw_flags =3D 0x2, rw_blocked_readers =3D 0= x0, rw_blocked_writers =3D 0x0, rw_spare =3D {0x0, 0x0, 0x0, 0x0}} In this situation I can see the backtrace of the process in the kernel, but "bt full" stops in frame 2: (kgdb) thread 705 [Switching to thread 705 (Thread 100956)]#0 sched_switch (td=3D0xfffff80052d114b0, newtd=3D, flags=3D) at /usr/src/sys/kern/sched_ule.c:1945 1945 cpuid =3D PCPU_GET(cpuid); (kgdb) bt #0 sched_switch (td=3D0xfffff80052d114b0, newtd=3D, flags=3D) at /usr/src/sys/kern/sched_ule.c:1945 #1 0xffffffff80551271 in mi_switch (flags=3D260, newtd=3D0x0) at /usr/src/sys/kern/kern_synch.c:491 #2 0xffffffff80594ffb in sleepq_catch_signals (wchan=3D0xfffff80052018c80, pri=3D0) at /usr/src/sys/kern/subr_sleepqueue.c:426 #3 0xffffffff80594eaf in sleepq_wait_sig (wchan=3D0x0, pri=3D0) at /usr/src/sys/kern/subr_sleepqueue.c:632 #4 0xffffffff80550c7d in _sleep (ident=3D, lock=3D, priority=3D, wmesg=3D, sbt=3D, pr=3D, flags=3D) at /usr/src/sys/kern/kern_synch.c:253 #5 0xffffffff80565285 in umtxq_sleep (uq=3D0xfffff80052018c80, wmesg=3D0xffffffff808b2ebc "uwrlck", abstime=3D0x0) at /usr/src/sys/kern/kern_umtx.c:780 #6 0xffffffff8056881f in do_rw_wrlock (td=3D0xfffff80052d114b0, rwlock=3D0x800a42880, timeout=3D) at /usr/src/sys/kern/kern_umtx.c:3109 #7 0xffffffff8056c4a7 in __umtx_op_rw_wrlock (td=3D, uap=3D) at /usr/src/sys/kern/kern_umtx.c:3657 #8 0xffffffff807db84f in amd64_syscall (td=3D0xfffff80052d114b0, traced=3D= 0) at subr_syscall.c:141 #9 0xffffffff807c040b in Xfast_syscall () at /usr/src/sys/amd64/amd64/exception.S:398 #10 0x0000000800833e8c in ?? () Previous frame inner to this frame (corrupt stack?) (kgdb) bt full #0 sched_switch (td=3D0xfffff80052d114b0, newtd=3D, flags=3D) at /usr/src/sys/kern/sched_ule.c:1945 tdq =3D ts =3D mtx =3D #1 0xffffffff80551271 in mi_switch (flags=3D260, newtd=3D0x0) at /usr/src/sys/kern/kern_synch.c:491 td =3D (struct thread *) 0xfffff80052d114b0 new_switchtime =3D runtime =3D #2 0xffffffff80594ffb in sleepq_catch_signals (wchan=3D0xfffff80052018c80, pri=3D0) at /usr/src/sys/kern/subr_sleepqueue.c:426 td =3D ret =3D Error accessing memory address 0x4: Bad address. --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-threads@freebsd.org Wed Aug 24 21:15:18 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0F7FBC5F8D for ; Wed, 24 Aug 2016 21:15:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D07FC1E15 for ; Wed, 24 Aug 2016 21:15:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7OLFIt7022323 for ; Wed, 24 Aug 2016 21:15:18 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Wed, 24 Aug 2016 21:15:18 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 21:15:19 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 --- Comment #5 from Konstantin Belousov --- Created attachment 174031 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D174031&action= =3Dedit Unset URWLOCK_READ_WAITERS even when error occured. I still unable to reproduce the problem on HEAD, and machine where I can is= not for testing kernel patches. Try this patch, please. --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-threads@freebsd.org Thu Aug 25 14:51:14 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6A8CBC5EEF for ; Thu, 25 Aug 2016 14:51:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D65E21AFC for ; Thu, 25 Aug 2016 14:51:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7PEpEp1060144 for ; Thu, 25 Aug 2016 14:51:14 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Thu, 25 Aug 2016 14:51:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: longwitz@incore.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 14:51:15 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 --- Comment #6 from longwitz@incore.de --- Your patch works fine. I have tested on two different machines both the testprogam thrtest.c and bconsole, no problems anymore. In the testprogram = you can remove the sleep(1), it was only to simulate some kind of working in bconsole. Thanks for quick solution ! --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-threads@freebsd.org Thu Aug 25 16:36:38 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B16EBC58BB for ; Thu, 25 Aug 2016 16:36:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A95418DA for ; Thu, 25 Aug 2016 16:36:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u7PGabYx070174 for ; Thu, 25 Aug 2016 16:36:38 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 211947] bconsole won't die sitting on do_rw_wrlock Date: Thu, 25 Aug 2016 16:36:37 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.3-STABLE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 16:36:38 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211947 --- Comment #7 from commit-hook@freebsd.org --- A commit references this bug: Author: kib Date: Thu Aug 25 16:35:42 UTC 2016 New revision: 304808 URL: https://svnweb.freebsd.org/changeset/base/304808 Log: Prevent leak of URWLOCK_READ_WAITERS flag for urwlocks. If there was some error, e.g. the sleep was interrupted, as in the referenced PR, do_rw_rdlock() did not cleared URWLOCK_READ_WAITERS. Since unlock only wakes up write waiters when there is no read waiters, for URWLOCK_PREFER_READER kind of locks, the result was missed wakeups for writers. In particular, the most visible victims are ld-elf.so locks in processes which loaded libthr, because rtld locks are urwlocks in prefer-reader mode. Normal rwlocks fall into prefer-reader mode only if thread already owns rw lock in read mode, which is not typical and correspondingly less visible. In the PR, unowned rtld bind lock was waited for in the process where only one thread was left alive. Note that do_rw_wrlock() correctly clears URWLOCK_WRITE_WAITERS in case of errors. Reported and tested by: longwitz@incore.de PR: 211947 Sponsored by: The FreeBSD Foundation MFC after: 1 week Changes: head/sys/kern/kern_umtx.c --=20 You are receiving this mail because: You are the assignee for the bug.=