HomePhabricator

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

Description

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

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8166

Details

Provenance
Jonas Schnelli <dev@jonasschnelli.ch>Authored on Oct 4 2017, 03:14
majcostaCommitted on Oct 29 2020, 15:47
majcostaPushed on Oct 29 2020, 15:47
Reviewer
Restricted Project
Differential Revision
D8166: [backport#11419] Utils: Fix launchctl not being able to stop bitcoind
Parents
rABCe5c7da9fd970: [backport#11594] Improve -disablewallet parameter interaction
Branches
Unknown
Tags
Unknown