From owner-freebsd-stable@FreeBSD.ORG Sat Jun 6 15:08:33 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EE10A6D for ; Sat, 6 Jun 2015 15:08:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A65F613A4 for ; Sat, 6 Jun 2015 15:08:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t56F8LT4063718 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 6 Jun 2015 18:08:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t56F8LT4063718 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t56F8LqM063717; Sat, 6 Jun 2015 18:08:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 6 Jun 2015 18:08:21 +0300 From: Konstantin Belousov To: Andre Meiser Cc: freebsd-stable@freebsd.org Subject: Re: Many core dumps in pthread_getspecific. Message-ID: <20150606150821.GG2499@kib.kiev.ua> References: <20150603145838.GX2499@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2015 15:08:33 -0000 On Sat, Jun 06, 2015 at 09:50:22AM +0200, Andre Meiser wrote: > On Wed, Jun 03, 2015 at 16:58 +0200, Konstantin Belousov wrote: > > You should recompile both libc and libthr with debugging symbols, like > > cd /usr/src > > (cd lib/libc && make all install DEBUG_FLAGS=-g) > > (cd lib/libthr && make all install DEBUG_FLAGS=-g) > > then obtain the core dump and post backtraces. > > Thank you, that was exactly what I was looking for. Now I like FreeBSD > even more. ;) > > I made this short after and also rebooted the entire system to make > all programmes use those debug libs. Since than I had not a single > core dump. Which means, most likely, that your installation was corrupted. > > I experienced something similar in the past, that with activated > debugging some errors can't be triggered any longer. > > At the moment I'm happy without crashes and I can work with this > system. As soon as I'm getting a new core dump, I'll post the > backtrace. If this won't happen for weeks, I may recompile the libs > again, try to find a way to trigger the bug on purpose, enable the > debug flag again and than provide the info. > > In the meantime, maybe a core developer may think about the lines > of code I'd provided. Why is _get_curthread() compared to NULL at > thr_kern.c (line 601) but not at thr_spec.c (line 224)? Either > _get_curthread() never ever returns NULL, than it's pointless to test > it or it's missing [not only] at thr_spec.c. Whole thr_kern.c file is 213 lines long in the HEAD. Might be, a core developer has a 601-lines long thr_kern.c. The only way for _get_curthread() to return NULL or, more likely, a garbage, is for the call to _get_curthread() to happens before the threading machinery was initialized. WRT the thr_spec.c, correct code must call pthread_key_create(3) at least once before calling any other pthread_key_*(3) functions. The implementation of pthread_key_create(3) interface, the function _pthread_key_create(), calls _thr_check_init() as the first action, and this helper initializes threading. So if _get_curthread() in any pthread_key_*() function returns NULL or garbage, this is an application' bug. > > I'm using activated hyperthreading: > > % sysctl hw.model hw.machine hw.ncpu hw.model: Intel(R) Xeon(R) CPU > E5-1620 v2 @ 3.70GHz hw.machine: amd64 hw.ncpu: 8 > > Sincerely yours Andre. _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable To > unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"