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.=