<p>This change substitutes use of memory efficient, OS supplied sleep/suspend<br>
inhibitor utilities for the silent audio file player on Linux, merges<br>
OSXStandbyModeDisabler functionality into AvoidStandyModeService, and<br>
removes that class.</p>
<p>This change also stops Bisq from running the audio file on OSX;  it is<br>
currently running both caffeinate and the silent audio file, and the avoid<br>
standby mode button in the the OSX settings view is currently toggling<br>
the audio player on and off, but not caffeinate.  (The only way to shut<br>
down caffeinate is by shutting down Bisq.)</p>
<p>The OSX avoid standby mode button button has not been hidden so a cached<br>
'do not avoid standby mode' preference does not leave the user stuck without<br>
a caffeinate service the next time they start Bisq. (They can use it to<br>
turn caffeinate on, but it can't be used to turn it off without shutting<br>
down Bisq too.)</p>
<p>The avoid standy mode button is now displayed on Linux because the native<br>
inhibitor can be toggled on and off.</p>
<p>There is no change to the avoid shutdown service on Windows and Unix.</p>

<p>OSX and UI related changes are described in the commit message above.  An<br>
explanation of Linux OS related changes follows.</p>
<p>On linux hosts, AvoidStandbyService checks for executables<br>
gnome-session-inhibit and systemd-inhibit in that order, then starts<br>
the first found to prevent suspend or sleep while Bisq is running.</p>
<p>To check if an inhibitor is enabled or disabled in a gnome terminal...</p>
<pre><code>$ dbus-send --session --print-reply --dest=org.gnome.SessionManager \
        /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors
</code></pre>
<p>If Bisq falls back to systemd-inhibit on a non gnome desktop...</p>
<pre><code>$ systemd-inhibit --list
$ systemd-inhibit --list | grep Bisq
</code></pre>
<p>If neither gnome-session-inhibit nor systemd-inhibit are found, the<br>
standby service falls back to playing the silent audio file.</p>
<p>This does not cover all linux desktop types, but other inhibitors<br>
exist for desktops I have not set up, such as mate.  It should not<br>
be difficult to support them.</p>
<p>Off heap memory use reduction varies from machine to (virtual) machine.<br>
On my Ubuntu 18 laptop, playing the audio file to block sleep/suspend<br>
is  allocating about 1 GB of native memory per hour via malloc() calls.<br>
On the same machine after warm-up, Bisq's  virtual memory usage goes from<br>
10.4 GB to 10.1 GB.  (This figure was tracked before the MaxRAM=4g setting<br>
was merged from PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="579282262" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/4048" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/4048/hovercard" href="https://github.com/bisq-network/bisq/pull/4048">#4048</a>.)</p>
<p>This has been tested on OSX Catalina 10.15, Ubuntu 18 (gnome) and the following VMs</p>
<pre><code>Debian 10.3 (gnome)
Arch Linux 9.2.1 (gnome)
Fedora 31.1.9 (cinnamon)
</code></pre>
<p>However, VMs not running an inhibitor or audio file do not always go into suspend mode<br>
as schedules.</p>
<p>This does not work on Windows Cygwin, but minor changes might make it work if<br>
cygwin inhibitor tools like gnome-session-inhibit.exe and mate-session-inhibit.exe<br>
are installed.</p>
<p>Paritally addresses off-heap memory consumption issues <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="484264045" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3128" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3128/hovercard" href="https://github.com/bisq-network/bisq/issues/3128">#3128</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="526636926" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3657" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3657/hovercard" href="https://github.com/bisq-network/bisq/issues/3657">#3657</a>,<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="555641551" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3918" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3918/hovercard" href="https://github.com/bisq-network/bisq/issues/3918">#3918</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="555246209" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3917" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3917/hovercard" href="https://github.com/bisq-network/bisq/issues/3917">#3917</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="528193912" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3686" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3686/hovercard" href="https://github.com/bisq-network/bisq/issues/3686">#3686</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="527741066" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/3677" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3677/hovercard" href="https://github.com/bisq-network/bisq/issues/3677">#3677</a></p>
<p>This PR replaces <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="579332131" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/4049" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/4049/hovercard" href="https://github.com/bisq-network/bisq/pull/4049">#4049</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/4060'>https://github.com/bisq-network/bisq/pull/4060</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Improve AvoidStandyModeService</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4060/files#diff-666314b6a179e5da1812adb6fbdbd778">core/src/main/java/bisq/core/app/AvoidStandbyModeService.java</a>
    (145)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4060/files#diff-151b69c4f6e62667c2af489def6c96ac">core/src/main/java/bisq/core/app/BisqExecutable.java</a>
    (1)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4060/files#diff-4047bc1d128c86544c9dea50eb854ad4">core/src/main/java/bisq/core/app/OSXStandbyModeDisabler.java</a>
    (27)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4060/files#diff-9b8f0c880377fee367822e838f776296">desktop/src/main/java/bisq/desktop/app/BisqApp.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4060/files#diff-4b017b0d9a41f82aa7cc162f16059c9f">desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/4060.patch'>https://github.com/bisq-network/bisq/pull/4060.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/4060.diff'>https://github.com/bisq-network/bisq/pull/4060.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/4060">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNRTACZF3DNAYDPPEGLRHJ3NBANCNFSM4LHH7VRA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNVMBSFIPNM7WM3ISZ3RHJ3NBA5CNFSM4LHH7VRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IU5333Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/4060",
"url": "https://github.com/bisq-network/bisq/pull/4060",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>