brew: Poor performance or infinite loop on `brew upgrade` dependent checking
I’ve released 2.1.16 which disables this functionality entirely until I rewrite it. If you hit this bug: brew update before posting anything here please and don’t post any “thanks” or “fixed for me” here, thanks. (@MikeMcQuaid)
I am not sure about the “reproducible” part because it does not happen every single time I do brew upgrade but a handful of times alread.
I also notice this seems to start happening since the portable ruby is being downloaded, and used by brew.
- ran
brew updateand can still reproduce the problem? - ran
brew doctor, fixed all issues and can still reproduce the problem? - ran
brew configandbrew doctorand included their output with your issue?
What you were trying to do (and why)
I ran brew upgrade to upgrade all (unpinned) packages and noticed a huge spikes in both CPU and RAM usage for ruby task, and the brew process did not seem to finish until I do Ctrl + C (in the terminal). I did not wait for long this time (probably around 30 seconds) but it happened before so I know it won’t stop until I do Ctrl + C.
It looks like it hung trying to remove old packages or something.
What happened (include command output)


I’m not sure if this might caused by one (or more) packages I tried to upgrade.
Command output
~ » brewug Updating Homebrew… ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae balena-cli
Error: Not upgrading 1 pinned package: dnscrypt-proxy 2.0.31 ==> Upgrading 5 outdated packages: python 3.7.4_1 -> 3.7.5 shared-mime-info 1.14 -> 1.15 ruby-build 20191030 -> 20191031 vagrant-completion 2.2.5 -> 2.2.6 imagemagick 7.0.9-1 -> 7.0.9-2 ==> Upgrading python ==> Downloading https://homebrew.bintray.com/bottles/python-3.7.5.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/bc/bcbdc3612a10d06facca7ec9499265731d530c8273b1a2dc28f16258d4410552?__gda__=exp=157261 ######################################################################## 100.0% ==> Pouring python-3.7.5.mojave.bottle.tar.gz ==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar ==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar ==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar ==> Caveats Python has been installed as /usr/local/bin/python3
Unversioned symlinks
python,python-config,pipetc. pointing topython3,python3-config,pip3etc., respectively, have been installed into /usr/local/opt/python/libexec/binIf you need Homebrew’s Python 2.7 run brew install python@2
You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.7/site-packages
See: https://docs.brew.sh/Homebrew-and-Python ==> Summary 🎉 /usr/local/Cellar/python/3.7.5: 3,972 files, 60.7MB Removing: /usr/local/Cellar/python/3.7.4_1… (3,875 files, 60.2MB) ==> Upgrading shared-mime-info ==> Downloading https://homebrew.bintray.com/bottles/shared-mime-info-1.15.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/1b/1be57687d8aef14d6bc95be0a02a5dfdbce4bf859ea057c93e3ff8545c700fcd?__gda__=exp=157261 ######################################################################## 100.0% ==> Pouring shared-mime-info-1.15.mojave.bottle.tar.gz Warning: The post-install step did not complete successfully You can try again using
brew postinstall shared-mime-info==> Summary 🎉 /usr/local/Cellar/shared-mime-info/1.15: 85 files, 4.7MB Removing: /usr/local/Cellar/shared-mime-info/1.14… (85 files, 4.7MB) Removing: /Users/ngoc/Library/Caches/Homebrew/shared-mime-info–1.14.mojave.bottle.tar.gz… (1.2MB) ==> Upgrading ruby-build ==> Downloading https://github.com/rbenv/ruby-build/archive/v20191031.tar.gz ==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v20191031 ######################################################################## 100.0% ==> ./install.sh 🎉 /usr/local/Cellar/ruby-build/20191031: 460 files, 230.4KB, built in 7 seconds Removing: /usr/local/Cellar/ruby-build/20191030… (460 files, 230.6KB) Removing: /Users/ngoc/Library/Caches/Homebrew/ruby-build–20191030.tar.gz… (62.1KB) ==> Upgrading vagrant-completion ==> Downloading https://github.com/hashicorp/vagrant/archive/v2.2.6.tar.gz ==> Downloading from https://codeload.github.com/hashicorp/vagrant/tar.gz/v2.2.6 ######################################################################## 100.0% ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Summary 🎉 /usr/local/Cellar/vagrant-completion/2.2.6: 6 files, 211.9KB, built in 5 seconds Removing: /usr/local/Cellar/vagrant-completion/2.2.5… (6 files, 209.6KB) ==> Upgrading imagemagick ==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.9-2.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/89/899550e6673673865683c1896a0e63d49b1034ef738d67a479d58bd8da9be7e8?__gda__=exp=157261 ######################################################################## 100.0% ==> Pouring imagemagick-7.0.9-2.mojave.bottle.tar.gz 🎉 /usr/local/Cellar/imagemagick/7.0.9-2: 1,479 files, 23.9MB Removing: /usr/local/Cellar/imagemagick/7.0.9-1… (1,479 files, 23.9MB) Removing: /Users/ngoc/Library/Caches/Homebrew/imagemagick–7.0.9-1.mojave.bottle.tar.gz… (9.5MB) ^C ~ » brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don’t worry or file an issue; just ignore this. Thanks!Warning: Unbrewed header files were found in /usr/local/include. If you didn’t put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted.
Unexpected header files: /usr/local/include/python3.6m/greenlet/greenlet.h ~ » brew config HOMEBREW_VERSION: 2.1.15-99-gdc32ab3 ORIGIN: https://github.com/Homebrew/brew HEAD: dc32ab3554c7060aff9e0889ca8a15121a41f738 Last commit: 4 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 70cbfd72dbdfe9ad134d6b89a28bbcd1b7769368 Core tap last commit: 12 minutes ago HOMEBREW_PREFIX: /usr/local HOMEBREW_DEV_CMD_RUN: 1 HOMEBREW_GITHUB_API_TOKEN: set HOMEBREW_INSTALL_BADGE: 🎉 HOMEBREW_NO_ANALYTICS: 1 HOMEBREW_VISUAL: vim CPU: octa-core 64-bit haswell Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin/ruby Clang: 10.0 build 1001 Git: 2.20.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.54.0 => /usr/bin/curl macOS: 10.14.6-x86_64 CLT: 10.3.0.0.1.1562985497 Xcode: N/A CLT headers: 10.3.0.0.1.1562985497 ~ »
What you expected to happen
The brew upgrade process successfully upgrades the packages, and stops executing, leaving no ruby process behind taking CPU and RAM resources.
Step-by-step reproduction instructions (by running brew commands)
- Run
brew update - See there are some updates to installed packages
- Run
brew upgradeto upgrade the packages (brewugis my alias) - Wait to see if it happens…
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 38 (13 by maintainers)
@MikeMcQuaid Gotcha!
I know it’s hard to trace bugs like this, and I totally agree that having a trully reproducible procedure, especially on the maintainer’s machine, would help a ton on getting the bug fix, but I guess this is just a strange issue, and could be that one package everyone here has installed.
Also, I’m sure no one is expecting the bugs are always fixed in a timely fashion because this is an open-source project, and we all really appreciate you guys effort putting on maintain this for all of us to use, so please relax we are not pushing you or anything. Please bear with us while we try to post things that might narrow this down, for you.
2.1.16 temporarily disabled this check entirely. 2.1.17 (or >2.1.16 on the
masterbranch) re-enables this, dramatically improves performance and adds more messages (without needing to use--verbose) to explain what’s going on. This should resolve all problems and, when/if it doesn’t, will help debug what exactly is going wrong.Sorry to sound picky, but “reproducible instructions”, per pretty much every report in this issue and others, are: Do a
brew upgrade. Unfortunately once a package is updated, it’s hard to reproduce it until the package releases a new version…I’ve released 2.1.16 which disables this functionality entirely until I rewrite it. If you hit this bug:
brew updatebefore posting anything here please and don’t post any “thanks” or “fixed for me” here, thanks.brew upgradeis back to normal for me. What’s changed since the last time I was consistently seeing this issue is that I upgraded Xcode, so perhaps @BrettDong is on to something. I have no idea.Here’s my
brew confignow:You can compare it to my
brew configfrom before. The key differences appear to be:To the folks still seeing this issue, perhaps try to apply any pending macOS or App Store updates, reboot, and then give
brew upgradeanother shot.Probably you may have a higher probability of running into this issue when App Store is updating apps in the background. I encountered this issue twice when App Store is updating Xcode.
edit: but anyway I am not sure if this really relates to the cause of this issue
Still seeing it here too on almost any update it does:
Okay so it just happened again. And it actually stopped (after about 5 minutes), so I apologize for saying that it didn’t stop earlier. I clearly just didn’t wait long enough. Not too sure about the time when I felt like I waited 10-15 minutes.
It did NOT happen the time before that