Cannot stop daemon when changing config for RPC #11586

issue cyberluke opened this issue on October 31, 2017
  1. cyberluke commented at 3:52 PM on October 31, 2017: none

    ./bitcoin-cli stop error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/home/ubuntu/.bitcoin/bitcoin.conf)

    This happens if you have bitcoind running, then you edit bitcoin.conf to add RPC port & credentials. Then you want to restart bitcoin daemon. But it is impossible to stop it as it tries to connect & close RPC that does not exist yet. So one have to kill the daemon.

  2. fanquake added the label RPC/REST/ZMQ on Oct 31, 2017
  3. achow101 commented at 4:26 PM on October 31, 2017: member

    You shouldn't be modifying any files in the bitcoin core datadir while Bitcoin core is running. It isn't designed to run like that.

  4. cyberluke commented at 4:40 PM on October 31, 2017: none

    Okay, I'm ignoring it is dumb decision not to be able to edit configuration text file and the daemon is re-reading it when exiting. Therefore if it is not a bug, but a feature, there should be some warning You cannot edit configuration while bitcoind is running or you will end in infinite loop :))))

  5. achow101 commented at 4:46 PM on October 31, 2017: member

    The software can't warn you against doing something which you do externally.

    Also, this isn't an infinite loop. Presumably you know what rpcuser and rpcpassword were before you changed them so you can use the -rpcpassword, -rpcuser, and -rpcport options in bitcoin-cli to set those options from the command line so it can still connect to bitcoind.

  6. MarcoFalke commented at 4:08 PM on November 1, 2017: member

    Indeed, you should revert bitcoin.conf to the previous version (the version that existed when you started the server) then stop and redo the changes to the conf.

    Feel free to add a warning, but I don't think this warrants to leave an issue open.

  7. MarcoFalke closed this on Nov 1, 2017

  8. cyberluke commented at 3:13 PM on November 3, 2017: none

    Ok, still I think it is messy. All other softwares load properties at start or don't require transactionally safe config file. Imagine you change ALL the parameteres and don't remember the exact values from previous session. Then you have to kill the server, which will corrupt your database. This all because of a bad file handling design.

  9. achow101 commented at 3:25 PM on November 3, 2017: member

    @cyberluke bitcoin-cli is a completely separate program from bitcoind. It can't possibly know whether you modified the bitcoin.conf while bitcoind was running. This is not "bad file handling design", there's just no other way for bitcoin-cli to know the rpcuser and password unless you explicitly give it those parameters.

  10. sipa commented at 3:31 PM on November 3, 2017: member

    SIGINT will cause bitcoind to shut down cleanly.

  11. bliotti referenced this in commit 03713ab929 on Jul 3, 2021
  12. MarcoFalke referenced this in commit 853ac47705 on Jul 15, 2021
  13. sidhujag referenced this in commit a2aa6e186a on Jul 23, 2021
  14. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me