unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Piet van Oostrum <piet@cs.uu.nl>
Subject: Emacs hangs on Mac OS X
Date: Wed, 03 Jan 2007 11:47:29 +0100	[thread overview]
Message-ID: <m2ps9wgzem.fsf@ordesa.cs.uu.nl> (raw)

With Emacs.app compiled from the pretest tarball (downloaded Dec 19) I get
a hang fairly often. I can't remember that I had these with the previous
version (from a CVS checkout), or at least much less often. Now I get them
about once a day. I have grabbed a stack trace with gdb:

#0  0xffff85d8 in ___spin_lock_relinquish () at /System/Library/Frameworks/System.framework/PrivateHeaders/ppc/cpu_capabilities.h:186
#1  0x900031b4 in szone_malloc ()
#2  0x900030e4 in malloc_zone_malloc ()
#3  0x907bb488 in CFAllocatorAllocate ()
#4  0x907dc41c in CFRunLoopRunSpecific ()
#5  0x93208740 in RunCurrentEventLoopInMode ()
#6  0x93207d4c in ReceiveNextEventCommon ()
#7  0x9330c940 in ReceiveNextEventInMode ()
#8  0x00158034 in XTread_socket (sd=0, expected=1, hold_quit=0xbfffca6c) at macterm.c:10410
#9  0x0008ad24 in read_avail_input (expected=0) at keyboard.c:6823
#10 0x001387a4 in alarm_signal_handler (signo=0) at atimer.c:397
#11 <signal handler called>
#12 0x9000437c in szone_malloc ()
#13 0x00000000 in ?? ()

I don't have the source of /System/Library/Frameworks/System.framework/
PrivateHeaders/ppc/cpu_capabilities.h, apparently this is compiled into the
system by Apple's developers.

It looks like a malloc call is interrupted by a timer alarm, and then the
system also needs a malloc. Malloc probably not being reentrant this should
be a cause of problems. Maybe the spin_lock stuff is a way to serialize the
malloc calls but this won't work for a signal handler, only for threads.

The timer is probably for poll_for_input.

I think something should be done to prevent mallocs (and probably also
frees) to be interrupted by the alarm signal. Or maybe doing the event loop
in a signal handler is not such a good idea.

Another possibility would be to run the event loop in a different thread
and let it put all events in a synchronized queue, where it can be popped
by read_avail_input.
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org

             reply	other threads:[~2007-01-03 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-03 10:47 Piet van Oostrum [this message]
2007-01-03 13:25 ` Emacs hangs on Mac OS X YAMAMOTO Mitsuharu
2007-01-03 21:39   ` Piet van Oostrum
2007-01-03 23:14     ` YAMAMOTO Mitsuharu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ps9wgzem.fsf@ordesa.cs.uu.nl \
    --to=piet@cs.uu.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).