unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18222: 24.3.92; fork handlers in gmalloc.c can lead to deadlock
@ 2014-08-08 13:09 Ken Brown
  2014-08-09  7:44 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 16+ messages in thread
From: Ken Brown @ 2014-08-08 13:09 UTC (permalink / raw)
  To: 18222

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






^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-08-28 19:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08 13:09 bug#18222: 24.3.92; fork handlers in gmalloc.c can lead to deadlock Ken Brown
2014-08-09  7:44 ` YAMAMOTO Mitsuharu
2014-08-09 19:24   ` Ken Brown
2014-08-11  2:16     ` Ken Brown
2014-08-11 14:44       ` Stefan Monnier
2014-08-11 15:29         ` Ken Brown
2014-08-23 16:00           ` Ken Brown
2014-08-24 23:28             ` YAMAMOTO Mitsuharu
2014-08-25  2:39               ` Eli Zaretskii
2014-08-25  4:15                 ` YAMAMOTO Mitsuharu
2014-08-25 12:17                 ` Ken Brown
2014-08-25 14:51                   ` Eli Zaretskii
2014-08-25 16:22                     ` Ken Brown
2014-08-28 14:51                       ` Ken Brown
2014-08-28 19:34                         ` Glenn Morris
2014-08-28 19:40                           ` Ken Brown

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).