> On 16/12/2019, at 3:48 AM, Alan Third > 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