From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#18222: 24.3.92; fork handlers in gmalloc.c can lead to deadlock Date: Fri, 08 Aug 2014 09:09:31 -0400 Message-ID: <53E4CC0B.2060200@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1407503492 7917 80.91.229.3 (8 Aug 2014 13:11:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Aug 2014 13:11:32 +0000 (UTC) To: 18222@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 08 15:11:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XFjx5-0000Uc-4F for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Aug 2014 15:11:23 +0200 Original-Received: from localhost ([::1]:51038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjx4-0008KN-Ju for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Aug 2014 09:11:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjwu-0008JD-8K for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:11:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFjwl-0000Kq-D7 for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:11:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjwl-0000KT-AU for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XFjwk-0004Bj-P9 for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Aug 2014 13:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18222 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140750341616036 (code B ref -1); Fri, 08 Aug 2014 13:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Aug 2014 13:10:16 +0000 Original-Received: from localhost ([127.0.0.1]:34779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XFjvz-0004AZ-RR for submit@debbugs.gnu.org; Fri, 08 Aug 2014 09:10:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41349) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XFjvx-0004AM-BW for submit@debbugs.gnu.org; Fri, 08 Aug 2014 09:10:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFjvl-00087N-3W for submit@debbugs.gnu.org; Fri, 08 Aug 2014 09:10:08 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjvl-00087J-17 for submit@debbugs.gnu.org; Fri, 08 Aug 2014 09:10:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjve-0008C0-VP for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:10:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFjvY-00085G-PH for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:09:54 -0400 Original-Received: from limerock04.mail.cornell.edu ([128.84.13.244]:43403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFjvY-000840-LG for bug-gnu-emacs@gnu.org; Fri, 08 Aug 2014 09:09:48 -0400 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id s78D9g1u028178 for ; Fri, 8 Aug 2014 09:09:43 -0400 Original-Received: from [192.168.1.4] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id s78D9f90002666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Fri, 8 Aug 2014 09:09:42 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92305 Archived-At: malloc_enable_thread() in gmalloc.c calls pthread_atfork to set up fork handlers. There are a couple of problems with this, but the immediate reason for this bug report is a problem on Cygwin that was reported in the thread starting at https://cygwin.com/ml/cygwin/2014-07/msg00387.html and continuing at https://cygwin.com/ml/cygwin/2014-08/msg00001.html. The issue is that the 'prepare' fork handler locks the pthread_mutexes prior to forking, and the ensuing processing of the fork command by the Cygwin DLL leads to a call to malloc in the same thread, resulting in deadlock. This is a long-standing problem, but it was masked until recently by the fact that pthread_mutexes on Cygwin were ERRORCHECK mutexes by default. As of Cygwin 1.7.31, pthread_mutexes are now NORMAL mutexes by default, so the problem has shown up. A simple short-term workaround would be to explicitly set the mutexes to be ERRORCHECK or RECURSIVE mutexes on Cygwin, thereby restoring the previous behavior. But this does not seem like the right long-term solution, for the reasons explained here: https://cygwin.com/ml/cygwin/2014-08/msg00161.html https://cygwin.com/ml/cygwin/2014-08/msg00175.html I know nothing about this other than what I learned from the two messages above, so I would appreciate some guidance. Ken