GNU bug report logs - #38618
27.0.50; Mach port leak on macOS Catalina causing crash

Previous Next

Package: emacs;

Reported by: Phillip Hutchings <phillip <at> iontech.nz>

Date: Sun, 15 Dec 2019 03:44:02 UTC

Severity: normal

Found in version 27.0.50

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 38618 <at> debbugs.gnu.org (full text, mbox):

From: Phillip Hutchings <phillip <at> iontech.nz>
Cc: 38618 <at> debbugs.gnu.org
Subject: Re: bug#38618: 27.0.50; Mach port leak on macOS Catalina causing crash
Date: Mon, 16 Dec 2019 17:01:40 +1300
[Message part 1 (text/plain, inline)]

> On 16/12/2019, at 3:48 AM, Alan Third <alan <at> idiocy.org <mailto:alan <at> idiocy.org>> wrote:
> 
> On Sun, Dec 15, 2019 at 02:35:10PM +1300, Phillip Hutchings wrote:
>> 
>> 
>> On macOS Catalina (all versions up to and including 10.15.2), after
>> opening a file stored on an iCloud Drive folder Emacs leaks Mach ports
>> eventually resulting in an Emacs crash during a random syscall.
>> 
>> Reproduction:
>> * Using Emacs for MacOS X (currently using Nightly build, but also on
>> the 26.3 release from 2019-09-02
>> * Open a file stored in an iCloud Drive folder, eg Documents when using
>> default settings
>> * Modify the file, no need to save it, only modify the contents
>> * Emacs will leak Mach ports on every edit.
>> 
>> This does not happen on non-iCloud Drive files, the port count observed 
>> in Activity Monitor does not change for these files.
>> 
>> So far I've removed all customisations, then tried disabling file
>> backups and auto saves, and pretty much anything I can think of that
>> accesses files. So far I haven't managed to find a cause. 
> 
> This sounds strange. I’m not on Catalina, nor do I use icloud, so I
> can’t debug this locally.
> 
> Can you try enabling NSTRACE (uncomment line 55 in nstrace.h) and then
> compare the output when editing a file that doesn’t leak vs one that
> does? It might be worth enabling NSTRACE_GROUP_EVENTS too, but it
> results in a ton of output, so perhaps try without it first.
> 
> Oh, and can you try testing with ‘emacs -nw’, just in case it’s not
> related to the window system code.
> -- 
> Alan Third


emacs -nw does not leak ports when editing the iCloud Drive documents.

I’ve built locally with NSTRACE and NSTRACE_GROUP_EVENTS. I can’t see any significant differences between the traces, but I’ve attached them in case you want to have a look.

Are there other debug options you can think of? I haven’t touched C or Cocoa in years but I’ll give it a shot.






—
Phillip Hutchings

[Message part 2 (text/html, inline)]
[trace-leak.txt (text/plain, attachment)]
[Message part 4 (text/html, inline)]
[trace-noleak.txt (text/plain, attachment)]
[Message part 6 (text/html, inline)]

This bug report was last modified 5 years and 155 days ago.

Previous Next


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