Patchwork D8141: darwin: add another preemptive gui() call when using chg

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2020, 2:05 a.m.
Message ID <differential-rev-PHID-DREV-soao57gbwiakwlyk4fdz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45280/
State Superseded
Headers show

Comments

phabricator - Feb. 21, 2020, 2:05 a.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Changeset a89381e04c58 <https://phab.mercurial-scm.org/rHGa89381e04c583f993f80814154a0834e6b1b6908> added this gui() call before background forks, and
  Google's extensions do background forks on essentially every invocation for
  logging purposes. The crash is reliably (though not 100%) reproducible without
  this change when running `HGPLAIN=1 chg status` in one of our repos. With this
  fix, I haven't been able to trigger the crash anymore.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8141

AFFECTED FILES
  mercurial/commandserver.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 21, 2020, 8:49 a.m.
marmoute added a comment.
marmoute accepted this revision.


  I would be nice to have test but I assume this is hard. The description seems clear so I trusting Kyle on this one.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8141/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8141

To: spectral, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel

Patch

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -545,6 +545,10 @@ 
         if maxlen < 0:
             raise error.Abort(_(b'negative max-repo-cache size not allowed'))
         self._repoloader = repocache.repoloader(ui, maxlen)
+        # attempt to avoid crash in CoreFoundation when using chg after fix in
+        # a89381e04c58
+        if pycompat.isdarwin:
+            procutil.gui()
 
     def init(self):
         self._sock = socket.socket(socket.AF_UNIX)