From owner-freebsd-current@freebsd.org Fri Mar 18 10:15:21 2016 Return-Path: Delivered-To: freebsd-current@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 1320DAD445A for ; Fri, 18 Mar 2016 10:15:21 +0000 (UTC) (envelope-from oleg@opentransfer.com) Received: from oleg.opentransfer.com (oleg.opentransfer.com [91.217.144.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "oleg-10.opentransfer.com", Issuer "oleg-10.opentransfer.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A05851497 for ; Fri, 18 Mar 2016 10:15:20 +0000 (UTC) (envelope-from oleg@opentransfer.com) Received: from asus.theweb.org.ua ([10.0.8.4]) by oleg.opentransfer.com (8.15.2/8.15.2) with ESMTPS id u2IAIhOx026463 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Mar 2016 12:18:46 +0200 (EET) (envelope-from oleg@opentransfer.com) Received: from asus.theweb.org.ua (localhost [127.0.0.1]) by asus.theweb.org.ua (8.15.2/8.15.2) with ESMTPS id u2IAFCh1035852 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 18 Mar 2016 12:15:12 +0200 (EET) (envelope-from oleg@opentransfer.com) Received: (from oleg@localhost) by asus.theweb.org.ua (8.15.2/8.15.2/Submit) id u2IAFB3i035851; Fri, 18 Mar 2016 12:15:11 +0200 (EET) (envelope-from oleg@opentransfer.com) X-Authentication-Warning: asus.theweb.org.ua: oleg set sender to oleg@opentransfer.com using -f From: "Oleg V. Nauman" To: Konstantin Belousov Cc: freebsd-current@freebsd.org Subject: Re: Fatal error 'mutex is on list' at line 139 in file /usr/src/lib/libthr/thread/thr_mutex.c (errno = 35) Date: Fri, 18 Mar 2016 12:15:11 +0200 Message-ID: <4148806.kI6iskSGtm@asus.theweb.org.ua> Organization: Ecommerce LLC User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160318095531.GX1741@kib.kiev.ua> References: <5093647.qxI0C33PyG@asus.theweb.org.ua> <20160318061457.GV1741@kib.kiev.ua> <20160318095531.GX1741@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2016 10:15:21 -0000 On Friday 18 March 2016 11:55:31 Konstantin Belousov wrote: > On Fri, Mar 18, 2016 at 08:14:57AM +0200, Konstantin Belousov wrote: > > Yes, please. It would be significantly easier to diagnose the problem if > > the minimal example is provided. If not, please pack one crashing app > > and all it non-system libraries and provide the tarball to me. > > Meantime you could also try the following change. I doubt that it would > fix your issue, but it is possibly related. Only libthr needs to be > rebuilt. I will try it tomorrow morning and will send the report. Thank you! > > diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c > index 7256b68..531e09c 100644 > --- a/lib/libthr/thread/thr_fork.c > +++ b/lib/libthr/thread/thr_fork.c > @@ -168,6 +168,7 @@ __thr_fork(void) > if (_thr_isthreaded() != 0) { > was_threaded = 1; > _malloc_prefork(); > + __thr_pshared_atfork_pre(); > _rtld_atfork_pre(rtld_locks); > } else { > was_threaded = 0; > @@ -202,8 +203,10 @@ __thr_fork(void) > > _thr_signal_postfork_child(); > > - if (was_threaded) > + if (was_threaded) { > _rtld_atfork_post(rtld_locks); > + __thr_pshared_atfork_post(); > + } > _thr_setthreaded(0); > > /* reinitalize library. */ > @@ -236,6 +239,7 @@ __thr_fork(void) > > if (was_threaded) { > _rtld_atfork_post(rtld_locks); > + __thr_pshared_atfork_post(); > _malloc_postfork(); > } > > diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c > index 3c81299..5e7f01c 100644 > --- a/lib/libthr/thread/thr_init.c > +++ b/lib/libthr/thread/thr_init.c > @@ -466,7 +466,6 @@ init_private(void) > _thr_once_init(); > _thr_spinlock_init(); > _thr_list_init(); > - __thr_pshared_init(); > _thr_wake_addr_init(); > _sleepq_init(); > _single_thread = NULL; > @@ -477,6 +476,7 @@ init_private(void) > * e.g. after a fork(). > */ > if (init_once == 0) { > + __thr_pshared_init(); > /* Find the stack top */ > mib[0] = CTL_KERN; > mib[1] = KERN_USRSTACK; > diff --git a/lib/libthr/thread/thr_private.h > b/lib/libthr/thread/thr_private.h index 31f8e6c..7ee1fbf 100644 > --- a/lib/libthr/thread/thr_private.h > +++ b/lib/libthr/thread/thr_private.h > @@ -952,6 +952,8 @@ void _tcb_dtor(struct tcb *); > void __thr_pshared_init(void) __hidden; > void *__thr_pshared_offpage(void *key, int doalloc) __hidden; > void __thr_pshared_destroy(void *key) __hidden; > +void __thr_pshared_atfork_pre(void) __hidden; > +void __thr_pshared_atfork_post(void) __hidden; > > __END_DECLS > > diff --git a/lib/libthr/thread/thr_pshared.c > b/lib/libthr/thread/thr_pshared.c index e8ccf1c..8371478 100644 > --- a/lib/libthr/thread/thr_pshared.c > +++ b/lib/libthr/thread/thr_pshared.c > @@ -252,3 +252,17 @@ __thr_pshared_destroy(void *key) > pshared_clean(key, val); > pshared_gc(curthread); > } > + > +void > +__thr_pshared_atfork_pre(void) > +{ > + > + _thr_rwl_rdlock(&pshared_lock); > +} > + > +void > +__thr_pshared_atfork_post(void) > +{ > + > + _thr_rwl_unlock(&pshared_lock); > +}