bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#15946: 24.3; Mac OS X, Mavericks, distnoted process


From: SB
Subject: bug#15946: 24.3; Mac OS X, Mavericks, distnoted process
Date: Fri, 27 Dec 2013 14:15:37 +0900

Hello, I've investigated this problem since I had similar symptoms
that correlated with everyone else's reports (quit emacs.app and
distnoted quiets down). Also, in my case when I download the vanilla
emacs.app from the emacs for OSX site, the problem does not appear. In
my case, under Mavericks, this problem only occurs when I use
Emacs.app with the inline patch applied (for more native Japanese
input).

Emacs inline patch
http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/emacs-inline.patch

After investigating, it seems that the purpose of distnoted is to
serve as a daemon to facilitate interapplication communication. In the
case of the "inline patch", to capture the moment the IME is changed
so that Emacs can do likewise to change language input. This is done
by adding an observer using NSDistributedNotificationCenter and there
is also a corresponding Core Foundation method. I didn't find any used
of NSDistributedNotificationCenter in the official release (24.3)
source.

https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/NSDistributedNotificationCenter_Class/Reference/Reference.html

The fix was to add
"suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately"
rather than the default which was
"NSNotificationSuspensionBehaviorCoalesce". For whatever reason,
modifying the inline patch in this manner fixed the issue for me. This
would be consistent with the report above that "Cmd Tabbing" seems to
trigger it (since it would activate the suspension behavior).

Others with the same problem seem to take a sledgehammer approach of
killing distnoted with a cronjob (which I did manually as well).

This is the patch (modified by hand so it may not apply) against emacs 24.3.

https://gist.github.com/anonymous/8142555

The modified line:

  [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
                    selector: @selector (changeInputMethod:)
                           name:
@"AppleSelectedInputSourcesChangedNotification" object: nil
suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];

Suspension Behavior
https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/NSDistributedNotificationCenter_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSNotificationSuspensionBehavior

For others who do not use the patch, there may be other applications,
since this is most likely a bug with Mavericks itself and you may want
to log distnoted for additional hints and grep the source of your
emacs build to see if NSDistributedNotificationCenter is being used.

Logging Distnoted
http://www.cocoawithlove.com/2009/02/interprocess-communication-snooping.html

Hope this helps someone.

Cheers,

Sam

On Mon, Dec 9, 2013 at 7:06 PM, Jan Djärv <jan.h.d@swipnet.se> wrote:
> Hello.
>
>> 9 dec 2013 kl. 05:38 skrev Christopher Smith <cbsmith@gmail.com>:
>>
>> Donald Tillman <don <at> till.com> writes:
>>> Hi!
>>>
>>> I use Emacs on Mac OS X, Mavericks, Intel MacBook Pro, downloaded from
>>> emacsformacosx.com.
>>>
>>> Running Emacs, a process named "distnoted" starts around 1% or 2% of the
>>> CPU, and after a while, slowly works its way up to 50% to 100% of
>>> the CPU.  Yoiks!  Actually there appear to be 3 distnoted processes,
>>> but only one eats up the CPU.
>>>
>>> Quitting Emacs brings distnoted down to under 1% within seconds.
>>
>> Just wanted to bump this up, as I've now seen this bug myself. Not sure
>> why Emacs is causing the problem. My emacs was built from macports.
>
> It is no use bumping anything that isn't reproducable. More helpful would be 
> if those that have this can do some debugging. For example dtruss on Emacs 
> and distnoted.
>
>      Jan D.
>
>





reply via email to

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