Page MenuHomePhabricator

[backport#11419] Utils: Fix launchctl not being able to stop bitcoind
ClosedPublic

Authored by majcosta on Oct 29 2020, 02:32.

Details

Summary

ab5bba778 Fix launchctl not being able to stop bitcoind (Alejandro Avilés)

Pull request description:

`bitcoind` should not be launched as daemon from the Launch Agent. Otherwise, the process cannot be stopped from `launchctl stop`/`launchctl unload`.

To reproduce the issue:

```console
$ launchctl load ~/Library/LaunchAgents/org.bitcoin.bitcoind.plist
$ pgrep -fla bitcoin
60225 /usr/local/opt/bitcoin/bin/bitcoind
$ launchctl unload ~/Library/LaunchAgents/org.bitcoin.bitcoind.plist
```

Wait a few seconds and then run `pgrep` again:

```console
$ pgrep -fla bitcoin
60225 /usr/local/opt/bitcoin/bin/bitcoind
```

The node is still running. This happens because Launch Agent is not supposed to run programs as daemons, since the agent makes sure they run in the background. Running them as daemons makes the Launch Agent lose control of the process and, so, it cannot be stopped.

Backport of Core PR11419

Test Plan

I don't have macOS to test this on, unfortunately

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable