emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs hangs on Mac OS X


From: Piet van Oostrum
Subject: Emacs hangs on Mac OS X
Date: Wed, 03 Jan 2007 11:47:29 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (darwin)

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 <address@hidden>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]