0

When creating a systemd service file for bitcoind (for example https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service), does it matter if Type=forking or Type=simple? What is the implication of one or the other in the light of how bitcoind starts and runs?

All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?

1 Answer 1

0

What is the implication of one or the other in the light of how bitcoind starts and runs?

Forking mode means that the program is going to call fork() and the process runs in the background while the main process exits. Simple mode means that the process stays running and doesn't exit unless the service is closed.

Since the .service file runs Bitcoin Core with -daemon, this means that it will call fork() and run in the background with the main process exiting. This is why it uses Forking mode.

All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?

They share the same behavior because they are all based on Bitcoin Core. They all have the -daemon option.

5
  • Running bitcoind without calling -daemon but having daemon=1 in the .conf is the same thing? Apr 18, 2018 at 18:26
  • Could you expand on the consequences of combining Type=simple and running bitcoind with the -daemon flag? Apr 18, 2018 at 18:51
  • Yes, -daemon and daemon=1 in the conf are the same thing. Running with Type=simple but -daemon means that once the process exits, systemd will think that it has stopped when in reality it is still running because a forked process was spawned in the background. Because it thinks the process stopped, it may attempt to restart it which could result in many forks of the bitcoind process (although those should exit once one bitcoind process exists).
    – Andrew Chow
    Apr 18, 2018 at 20:08
  • So there are no consequences in terms of performance, stability, resource usage?... one or the other yields the same result, as long as the daemon flag agrees? Apr 19, 2018 at 17:44
  • Yes, there is no performance difference.
    – Andrew Chow
    Apr 19, 2018 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.