Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve diagnostic for Git fsmonitor settings in Homebrew repository: #17794

Closed
wants to merge 1 commit into from

Conversation

mfilippov
Copy link

  • Added a check for the core.fsmonitor setting in the Homebrew repository
  • Provided an error message with instructions to disable fsmonitor if it is set to 'true'
  • Ensured the instructions specify making the change in the Homebrew repository folder

This update helps prevent potential issues with lock files during 'brew upgrade' operations.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

- Added a check for the core.fsmonitor setting in the Homebrew repository
- Provided an error message with instructions to disable fsmonitor if it is set to 'true'
- Ensured the instructions specify making the change in the Homebrew repository folder

This update helps prevent potential issues with lock files during 'brew upgrade' operations.
@carlocab
Copy link
Member

We already set core.fsmonitor to false during brew update.

Is this not working for you?

@mfilippov
Copy link
Author

@carlocab It didn't work for me. I received message from brew about another process running. I checked running process and find git fsmonitor process which hold lock file.

@carlocab
Copy link
Member

What's the output of your brew config?

@mfilippov
Copy link
Author

HOMEBREW_VERSION: 4.3.10
ORIGIN: https://github.com/Homebrew/brew
HEAD: c3ae0327c01aab461531bfc0fcdfb4dd3a779205
Last commit: Good "git" signature with ECDSA key SHA256:ZtBmHHUCxZtGFkIZAmRhzIN1Pj37nqiL5sRRyoFxc2c
No principal matched.
16 hours ago
Core tap JSON: 19 Jul 08:59 UTC
Core cask tap JSON: 19 Jul 08:59 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BAT_THEME: GitHub
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: /opt/homebrew/bin/micro
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_NO_ANALYTICS: set
Homebrew Ruby: 3.3.3 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.45.2 => /opt/homebrew/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false

@Bo98
Copy link
Member

Bo98 commented Jul 25, 2024

I don't see how the instructions here do anything different to:

if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && "${HOMEBREW_REPOSITORY}" = "${HOMEBREW_PREFIX}" ]]
then
# Git's fsmonitor prevents the release of our locks
git config --bool core.fsmonitor false
fi

Might be worth debugging why that's not kicking in on your system.

The Last commit line in your brew config seems to have extra output too.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Unfortunately, also want to hold off on this until we figure out what's not working with the existing logic.

@mfilippov
Copy link
Author

You right I see set fsmonitor false now. Maybe I have old version of brew or something strange happened. I will investigate issue if it will happen again.

@mfilippov mfilippov closed this Jul 29, 2024
@mfilippov
Copy link
Author

mfilippov commented Jul 31, 2024

@carlocab I think I found the reason for the issue:

COMMAND   PID      USER   FD     TYPE             DEVICE SIZE/OFF                NODE NAME
git     39004 mfilippov  cwd      DIR               1,16     2016              255440 /Users/mfilippov
git     39004 mfilippov  txt      REG               1,16  3599840           560946711 /opt/homebrew/Cellar/git/2.45.2/bin/git
git     39004 mfilippov  txt      REG               1,16   162656           468225747 /opt/homebrew/Cellar/gettext/0.22.5/lib/libintl.8.dylib
git     39004 mfilippov  txt      REG               1,16   545424           560918824 /opt/homebrew/Cellar/pcre2/10.44/lib/libpcre2-8.0.dylib
git     39004 mfilippov    0u     CHR                3,2      0t0                 333 /dev/null
git     39004 mfilippov    1u     CHR                3,2      0t0                 333 /dev/null
git     39004 mfilippov    2u     CHR                3,2      0t0                 333 /dev/null
git     39004 mfilippov    3u  KQUEUE                                                 count=0, state=0x8
git     39004 mfilippov    4r     DIR               1,16      288           154470969 /opt/homebrew/Library/Taps/umputun/homebrew-apps
git     39004 mfilippov    5r     DIR               1,16       96           154470968 /opt/homebrew/Library/Taps/umputun
git     39004 mfilippov    6r     DIR               1,16      128              509384 /opt/homebrew/Library/Taps
git     39004 mfilippov    7r     DIR               1,16      192              506076 /opt/homebrew/Library
git     39004 mfilippov    8r     DIR               1,16     1088              390632 /opt/homebrew
git     39004 mfilippov    9r     DIR               1,16      128               26283 /opt
git     39004 mfilippov   10r     DIR               1,16      672 1152921500311879682 /System/Volumes/Data
git     39004 mfilippov   11r     DIR               1,16      448 1152921500312503192 /System/Volumes
git     39004 mfilippov   12r     DIR               1,16      320 1152921500311879701 /System
git     39004 mfilippov   13u    unix 0x2451ea5996091de5      0t0                     ->0xb8583a1fbf2fa97f
git     39004 mfilippov   14u    unix 0xb8583a1fbf2fa97f      0t0                     ->0x2451ea5996091de5
git     39004 mfilippov   16u    unix 0xedfafe2d23c7ab72      0t0                     /opt/homebrew/Library/Taps/umputun/homebrew-apps/.git/fsmonitor--daemon.ipc
git     39004 mfilippov  200w     REG               1,16        0           561638823 /opt/homebrew/var/homebrew/locks/update
/opt/homebrew/Library/Taps/umputun/homebrew-apps# git config --get core.fsmonitor      
true

Could you apply the same thing to repositories in Taps?

@carlocab
Copy link
Member

We could, though I've been under the impression that that wouldn't be needed.

I wonder if we should just make sure that lock gets release (e.g. by closing file descriptor 200 at the end of update.sh, perhaps? Or just deleting it?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants