GNU bug report logs - #18222
24.3.92; fork handlers in gmalloc.c can lead to deadlock

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Fri, 8 Aug 2014 13:11:01 UTC

Severity: normal

Found in version 24.3.92

Fixed in version 25.1

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ken Brown <kbrown <at> cornell.edu>
Subject: bug#18222: closed (Re: bug#18222: 24.3.92; fork handlers in
 gmalloc.c can lead to deadlock)
Date: Thu, 28 Aug 2014 19:41:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#18222: 24.3.92; fork handlers in gmalloc.c can lead to deadlock

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 18222 <at> debbugs.gnu.org.

-- 
18222: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18222
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ken Brown <kbrown <at> cornell.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 18222-done <at> debbugs.gnu.org,
 peterhull90 <at> gmail.com
Subject: Re: bug#18222: 24.3.92;
 fork handlers in gmalloc.c can lead to deadlock
Date: Thu, 28 Aug 2014 15:40:18 -0400
Version: 24.5

> Closing a bug doesn't prevent further discussion.
> (In my experience not closing it just means people tend to forget to do
> that later.)

OK. Closed.


[Message part 3 (message/rfc822, inline)]
From: Ken Brown <kbrown <at> cornell.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92; fork handlers in gmalloc.c can lead to deadlock
Date: Fri, 08 Aug 2014 09:09:31 -0400
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




This bug report was last modified 10 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.