OSX Maverick “App Nap” slowdown #3182

issue gavinandresen openend this issue on October 29, 2013
  1. gavinandresen commented at 4:36 am on October 29, 2013: contributor

    Reported via email:

    The only issue I’ve come across period, isn’t really a problem. But it is confusing to someone downloading Bitcoin-Qt unaware of OS X Maverick’s under the surface options. When I first opened it up and set if off downloading the blockchain I thought there was a problem as it was doing it incredibly slow. Much slower than usual. And when I clicked on the battery icon at the top of the screen, there’s a new feature in Mavericks which lets you know of “Apps Using Significant Energy”. When Chrome was the only app that appeared I realized something was wrong.

    I had a bit of knowledge about a new feature in Mavericks called App Nap and I had a hunch it was something to do with that. It was. App Nap is a new feature designed for optimizing battery life that puts background/non-visible apps with no audio, video or otherwise relevant to current usage, to sleep. So whenever I was browsing in Chrome, Qt was fully napping. I have since read that there’s a full App Nap API for developers to take advantage of to tweak which parts or aspects of an app can or can’t be put to sleep, or turn off napping of the app full stop; so devs have control over this feature, but it is enabled by default.

    Until then, I figured out a simple way to turn off app napping on the user’s side with any app as well. You can right click any app, click Get Info, and at the top there’s a new checkbox named Prevent App Nap. I imagine this is useful to anyone, or yourself, using Qt on Mavericks as doing anything without it seems to completely stop Qt from synchronising with the blockchain.

  2. laanwj commented at 11:45 am on October 29, 2013: member
    Seems that we need even more mac-specific code :)
  3. TheButterZone commented at 0:38 am on October 30, 2013: none
  4. jemmons commented at 6:01 pm on November 5, 2013: none
    App Nap and compressed memory are orthogonal technologies. They really don’t have much to do with one another.
  5. mikehearn commented at 11:29 am on November 13, 2013: contributor

    The core problem here is that running highly intensive background processes on battery powered devices is a stupid thing to do, which is why Apple has been “cracking down” on it.

    At some point we need to bite this bullet. Until it gets an SPV mode, Bitcoin-Qt does not make sense to run on laptops. Simple as that.

  6. raarts commented at 12:05 pm on November 16, 2013: none
    @mikehearn : can you please enlighten? Laptops seem to becoming the norm. My backup client for example gives me the choice to pause when battery drops below a configurable threshold. I just installed Bitcoin-qt, do you think that was a bad choice?
  7. mikehearn commented at 2:19 pm on November 16, 2013: contributor
    If you’re OK with long sync times and so on go right ahead and use it, but it’s a very computationally intensive app so you should expect it to use a lot of battery power (a lot more than your other apps)
  8. raarts commented at 3:42 pm on November 16, 2013: none
    So, from a battery power standpoint, what would be the best alternative?
  9. mikehearn commented at 6:31 pm on November 16, 2013: contributor
    An SPV client that doesn’t process the whole block chain.
  10. gubatron commented at 0:45 am on November 21, 2013: contributor

    We also have this same issue on FrostWire, the simplest way to solve it (if you want the app marked as disabled from the start from AppNap) is to invoke the following command:

    Supposedly doing this would disable AppNap, but I just tested and it doesnt. defaults write org.bitcoinfoundation.Bitcoin-Qt NSAppSleepDisabled -bool YES

    What I know for a fact, is that if you disable app nap on the Get Info dialog, the application will be added to a Dictionary inside the file ~/Library/Preferences/com.apple.LaunchServices.plist

    If I understand correctly we can use the Qt QSettings class to edit that property file programatically in MacOSX, we could alter the file ourselves on the first run if we detect Mavericks.

    I’d be glad to submit a patch doing this to get myself warmed up. I also read there’s an issue building on Mavericks, I’m probably going to have to solve it for myself If I want to collaborate.

  11. Megatokio commented at 1:29 pm on December 4, 2013: none

    This should be fixed quickly or there should be an easy-to-see and easy-to-find hint to all OSX users because waiting weeks for syncing the block chain will make most people abandon bitcoin-qt.

    I’m waiting for the catchup to happen now for 2 weeks, on a desktop 2x3GHz iMac, and it was, until disabling AppNap, catching up 10-20 days/day (May/Jun ‘13). I’m pretty patient, but bitcoin-qt blocks a lot of ram while living.

    But even with AppNap disabled it’s now slow again, after starting with some speed, and its neither the cpu (<5%) nor adsl/internet (<1%). hm.. i’ll see tomorrow…

  12. tom-seddon commented at 9:42 am on December 31, 2013: none

    I’ve found this a bit annoying too. Left bitcoin-qt running overnight; came back in the morning to find it had done… pretty much nothing.

    Regarding laptops and their battery time, I don’t understand the problem. My laptop has a plug - is it so unusual? (That’s a rhetorical question by the way.) I’d suggest that this should be supported, even if it’s just with a note in the readme.

    Thanks,

    –Tom

  13. mikehearn commented at 1:09 pm on December 31, 2013: contributor
    Leaving a laptop plugged in and switched on all the time would be unusual yes, that’s why Apple don’t optimise for that case. Even if you got caught up whilst the laptop was plugged in and running 24/7, the moment you closed the lid you’d start to fall behind again. Go on vacation? Be prepared for a long wait when you get back home before the app is usable again.
  14. gubatron commented at 7:05 pm on December 31, 2013: contributor

    I hardly unplug mine, only when i go out. So I don’t think it’s unusual to have it plugged.

    http://twitter.com/gubatron

    On Tue, Dec 31, 2013 at 8:09 AM, Mike Hearn notifications@github.comwrote:

    Leaving a laptop plugged in and switched on all the time would be unusual yes, that’s why Apple don’t optimise for that case. Even if you got caught up whilst the laptop was plugged in and running 24/7, the moment you closed the lid you’d start to fall behind again. Go on vacation? Be prepared for a long wait when you get back home before the app is usable again.

    — Reply to this email directly or view it on GitHubhttps://github.com/bitcoin/bitcoin/issues/3182#issuecomment-31394196 .

  15. laanwj removed the label Inactive on May 9, 2014
  16. laanwj closed this on Dec 29, 2014

  17. laanwj commented at 9:02 am on December 29, 2014: member
    app nap was disabled in #5041 (thanks @jonasschnelli for bringing my attention to this)
  18. Bushstar referenced this in commit 372389d231 on Apr 8, 2020
  19. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-08 22:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me