Subject: bug#38618: closed (Re: bug#38618: 27.0.50; Mach port leak on macOS Catalina causing crash)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 22 Dec 2019 11:51:01 +0000

Your bug report

#38618: 27.0.50; Mach port leak on macOS Catalina causing crash

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
38618: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38618
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#38618: 27.0.50; Mach port leak on macOS Catalina causing crash
From: Alan Third <[email-masked]>
To: Phillip Hutchings <[email-masked]>
Cc: YAMAMOTO Mitsuharu <[email-masked]>, [email-masked]
Date: Sun, 22 Dec 2019 11:49:56 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

On Wed, Dec 18, 2019 at 10:29:06AM +1300, Phillip Hutchings wrote:
> On 18/12/2019, at 10:23 AM, Alan Third <[email-masked]> wrote:
> > 
> > On Tue, Dec 17, 2019 at 12:49:07PM +0900, YAMAMOTO Mitsuharu wrote:
> >> 
> >> The Mac port (not the NS port in your report) also has the problem of
> >> Mach port leaks in -[NSWindow setRepresentedURL:] on macOS 10.15.  I
> >> think this is a bug in AppKit or some lower-level stuff.  I'll file it
> >> to Apple later.
> >> 
> >> I've installed a workaround into the "work" branch of the repository
> >> of the Mac port:
> >> 
> >>  https://bitbucket.org/mituharu/emacs-mac/commits/19c97087065b7ca64b71f392a453673042e024c6
> > 
> > Thank you for finding the problem!
> > 
> > Can someone on 10.15 try the attached patch, please?
> 
> Just tested the patch against the same revision I was using
> previously (dd162a3f) and the port leak is fixed, thanks!

Thanks everyone. Change pushed to master.
-- 
Alan Third

Subject: 27.0.50; Mach port leak on macOS Catalina causing crash
From: Phillip Hutchings <[email-masked]>
To: [email-masked]
Date: Sun, 15 Dec 2019 14:35:10 +1300
List-Id: <debbugs-submit.debbugs.gnu.org>

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. 

In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1894.20 Version 10.15.2 (Build 19C57))
of 2019-12-15 built on Tarvos.localdomain
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.2

Recent messages:
Loading cus-start...done
Loading tooltip...done
Loading /Applications/Emacs.app/Contents/Resources/lisp/leim/leim-list.el (source)...done
Finding pointers to doc strings...done
Loading counsel-projectile...done
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-specific abbrevs work. 
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading loadup.el (source)...done
Package cl is deprecated

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS PDUMPER

Important settings:
  value of $LANG: en_NZ.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  global-flycheck-mode: t
  global-company-mode: t
  global-evil-surround-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  override-global-mode: t
  counsel-projectile-mode: t
  projectile-mode: t
  ivy-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/sitharus/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode hides /Applications/Emacs.app/Contents/Resources/lisp/textmodes/less-css-mode

Features:
(shadow sort mail-extr emacsbug sendmail company-jedi jedi-core
python-environment epc ctable concurrent deferred python-mode info-look
tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat parse-time iso8601 ls-lisp hippie-exp flymake-proc flymake
warnings magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process magit-mode transient
git-commit recentf tree-widget wid-edit magit-git magit-section
benchmark magit-utils which-func vc-git diff-mode crm log-edit message
rmc format-spec rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor async-bytecomp async server omnisharp
omnisharp-unit-test-actions omnisharp-code-structure
omnisharp-server-installation gnutls puny omnisharp-format-actions
omnisharp-solution-actions omnisharp-helm-integration
omnisharp-navigation-actions omnisharp-current-symbol-actions
omnisharp-auto-complete-actions omnisharp-server-actions
omnisharp-http-utils omnisharp-utils omnisharp-server-management
omnisharp-settings f s flycheck find-func popup dash ido csharp-mode
imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs cl web-mode disp-table company-oddmuse
company-keywords company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb company pcase evil-surround evil
evil-keybindings evil-integration undo-tree diff evil-maps evil-commands
reveal flyspell ispell evil-jumps evil-command-window evil-types
evil-search evil-ex shell pcomplete evil-macros evil-repeat evil-states
evil-core advice evil-common windmove rect evil-digraphs evil-vars
edmacro kmacro use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core sanityinc-tomorrow-night-theme
color-theme-sanityinc-tomorrow counsel-projectile projectile grep
ibuf-ext ibuffer ibuffer-loaddefs thingatpt counsel xdg xref project
dired dired-loaddefs compile comint ansi-color swiper cl-extra help-mode
ivy delsel ring colir color ivy-overlay cus-load finder-inf rx info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip cus-start eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 814370 53977)
(symbols 48 55310 6)
(strings 32 193619 6734)
(string-bytes 1 6812928)
(vectors 16 94818)
(vector-slots 8 1886766 55226)
(floats 8 506 37)
(intervals 56 367 119)
(buffers 1000 12))

Phillip Hutchings / Managing Director
[email-masked] / 021 500 359

Ion Technologies Limited
https://www.iontech.nz <https://www.iontech.nz/>
Level 1, 3 Cobham Road, Kerikeri