[bisq-network/bisq] OSX App Nap mode causes Bisq to lose network connections (#1701)

Manfred Karrer notifications at github.com
Thu Sep 20 15:59:14 UTC 2018


@cbeams The introduced AppNap in earlier versions already but might have been changed in the under the hood behavior. I have Sierra but observed that issues since a while (prob. when I updated). 
I tested yesterday and could reproduce it when having Bisq with offers online on my iMac, then let it go in standby (monitor only), then try to take that offer from my laptop. The first few minutes it worked, afterwards it could not connect to the user anymore. The offer stayed online longer. Might be that offer republishing still works more or less. I think its not very deterministic behavior but rather limiting resources. Could also be related to other system environment (e.g. you have many apps open, etc.). With the sound keeping playing silently all worked (left it over night and the laptop could connect to the iMac Bisq apps offers).

It seems that `LSAppNapIsDisabled` and `NSAppSleepDisabled` are not supported anymore. At least it did not pass my test scenarios.
Only alternative way what worked was to use `defaults write io.bisq.CAT NSAppSleepDisabled -bool YES` but I don't know a easy way how we can trigger that from the app. It need to be done before the app starts, so it is probably impossible to do that from the java app. So only way would be to tell users to run that command, but I prefer to handle it automatically without annoying the user with any extra steps. 

I have seen some issue at Bitcoin Core where they discussed to fall back to an alternative solution (but did not find the link anymore, will search again). I think they have the option to call a OSX system call directly. We could do that probably as well but that would introduce native code, which I prefer to avoid.

Playing the sound might be also useful for other OS standby behaviors, I assume at least Windows will have or will add in future similar stuff (as for laptops on battery App Nap is a useful feature). For Bisq users we should note that they should not leave Bisq running on a laptop on low battery, but I think most will not do that anyway...

Btw. the play sound code is pretty simple:
```
            URL resource = getClass().getResource("/test.aiff");
            MediaPlayer mediaPlayer =new MediaPlayer(new Media(resource.toString()));
            mediaPlayer.setOnEndOfMedia(() -> mediaPlayer.seek(Duration.ZERO));
            mediaPlayer.setVolume(0);
            mediaPlayer.play();
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/issues/1701#issuecomment-423236806
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20180920/f8b4bec6/attachment.html>


More information about the bisq-github mailing list