[MacPorts] #66067: enabling git fsmonitor causes base to hang on git operations

MacPorts noreply at macports.org
Wed Oct 26 08:23:15 UTC 2022


#66067: enabling git fsmonitor causes base to hang on git operations
--------------------------+----------------------
 Reporter:  cjones051073  |      Owner:  (none)
     Type:  defect        |     Status:  assigned
 Priority:  Normal        |  Milestone:
Component:  base          |    Version:  2.8.0
 Keywords:                |       Port:
--------------------------+----------------------
 There is an issue with the latest base release, 2.8.0, not present with
 2.7.x that causes base to hang if the user has

 a) Set their ports tree to be a git clone and

 b) Enabled the fsmonitor feature of recent git versions.

 The feature is available since git 2.37

 https://github.blog/2022-06-27-highlights-from-git-2-37/#a-builtin-
 filesystem-monitor-for-windows-and-macos

 Enabling it just requires running

 {{{
  > git config core.fsmonitor true
 }}}

 When this is done, and if a) above is satisfied commands like `port sync`
 hang up just after the git command spawned completes

 {{{
 Oberon ~/Projects/MacPorts/ports > sudo port -d sync
 DEBUG: Copying /Users/chris/Library/Preferences/com.apple.dt.Xcode.plist
 to /opt/local/var/macports/home/Library/Preferences
 --->  Updating the ports tree
 Synchronizing local ports tree from
 file:///Users/chris/Projects/MacPorts/ports
 DEBUG: euid/egid changed to: 501/20, env: HOME=/Users/chris
 DEBUG: /opt/local/bin/git pull --rebase --autostash
 DEBUG: system -W /Users/chris/Projects/MacPorts/ports: /opt/local/bin/git
 pull --rebase --autostash
 Already up to date.
 <hangup>
 }}}

 If, during this hangup, I check the processes running I see this one

 67138 s010  S+     0:00.01 /opt/local/libexec/git-core/git fsmonitor--
 daemon run --detach --ipc-threads=8

 and indeed if I manually kill that process the port sync command
 continues.

 So... A simple reproducer for the issue is the following

 1. Configure your macports installation to use a git clone of the ports
 tree in your personal user area, instead of the default tarball approach.
 In my case this is under /Users/chris/Projects/MacPorts/ports.

 2. Install macports git

   > sudo port install git

 3. Enable the fs monitor for the ports tree checkout you made in 1.

   > cd /Users/chris/Projects/MacPorts/ports
   > git config core.fsmonitor true

 3. run 'port -d sync'

 My guess from the above is port is waiting for the git command it spawned
 to complete, but isn't handling correctly the fact that with the fsmonitor
 option enabled git could spawn a sub-process that remains running after
 the command that spawned it completes.

 This was not an issue with the previous 2.7.x releases, so appears to be
 an issue new to 2.8.0.

-- 
Ticket URL: <https://trac.macports.org/ticket/66067>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list