bitcoin-cli is not able to communicate with the bitcoind #28357

issue vincenzopalazzo opened this issue on August 28, 2023
  1. vincenzopalazzo commented at 9:48 AM on August 28, 2023: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Sometimes while I am running bitcoind on my machine I am not able to use the bitcoin-cli, this is an example of use case

    ➜  VincentSSD bitcoind -datadir=/run/media/vincent/VincentSSD/.bitcoin --signet -daemon
    Error: Cannot obtain a lock on data directory /run/media/vincent/VincentSSD/.bitcoin/signet. Bitcoin Core is probably already running.
    ➜  VincentSSD bitcoin-cli -datadir=/run/media/vincent/VincentSSD/.bitcoin --signet -getinfo
    error: timeout on transient error: Could not connect to the server 127.0.0.1:38332
    
    Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
    

    But all start to work when I kill the bitcoind process and restart with the same command

    My bitcoin.conf

    [signet]
    bind=127.0.0.1
    rpcuser=itisnotthis
    rpcpassword=itisnotthis
    rpcport=38332
    

    Expected behaviour

    If bitcoin-cli cannot talk with bitcoind for some reason, some line at an error level should be printed.

    From my analysis, it looks like the server is dying because I am also not able to connect remotely to it, but there is no log line that points me to this.

    Steps to reproduce

    Running bitcoind on a machine and hoping to see the bitcoin-cli error or some error in the application that it is not able to connect to the RPC server.

    Relevant log output

    I will add it later, now I deleted my logs for a mistake!

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    Bitcoin Core RPC client version v24.0.1

    Operating system and version

    Arch Linux x86_64

    Machine specifications

    12th Gen Intel i7-1260P (16) @ 4.700GHz

  2. maflcko commented at 9:59 AM on August 28, 2023: member

    I will add it later, now I deleted my logs for a mistake!

    Attaching gdb may also be useful.

  3. maflcko commented at 7:05 AM on August 29, 2023: member

    Closing for now, but please let us know once and if you have more details, otherwise this is impossible to debug.

  4. maflcko closed this on Aug 29, 2023

  5. vincenzopalazzo commented at 10:00 AM on August 29, 2023: none

    Attaching gdb may also be useful.

    IMHO here gdb is not an option because the disconnection from the RPC is not deterministic, so this can happens also after 3 months

    Closing for now, but please let us know once and if you have more details, otherwise this is impossible to debug.

    Okay, maybe you can give me some hits on what kind of debug log read to choose? rpc and HTTP are not working.

    So IMHO, this issue should stay open till there is a way at least to debug it because I do not see any way to do it, but maybe you can have a suggestion

  6. maflcko commented at 10:03 AM on August 29, 2023: member

    I think it is possible to attach gdb after a program has started, even after 3 months.

    You can find the debug.log in your data dir.

    Please be aware that the debug log might contain personally identifying information.

  7. maflcko commented at 10:07 AM on August 29, 2023: member

    So IMHO, this issue should stay open

    Not sure about keeping issues open, where nothing can be done to fix them. It should be trivial to re-open it once and if more details are available. Also, nothing is deleted and anyone is free to continue the discussion here.

  8. vincenzopalazzo commented at 10:15 AM on August 29, 2023: none

    Not sure about keeping issues open, where nothing can be done to fix them

    I think it is possible to improve the log when the RPC crashes or something

  9. maflcko commented at 10:24 AM on August 29, 2023: member

    Not sure about keeping issues open, where nothing can be done to fix them

    I think it is possible to improve the log when the RPC crashes or something

    I don't think it is possible to improve the log Make sure the bitcoind server is running and that you are connecting to the correct RPC port. If you disagree, it would be good to suggest what should be changed and how.

    If the RPC crashes due to a bug, the bug should be fixed, and not the log message be adjusted.

  10. vincenzopalazzo commented at 10:44 AM on August 29, 2023: none

    If the RPC crashes due to a bug, the bug should be fixed, and not the log message be adjusted.

    I agree on it, but if the RPC silent crash we make it a little bit easier to track?

    This happens also to one of my mentees and without logs it is super hard to track it down.

    The log should be emitter by bitcoind not bitcoin-cli? the cli is just a client

  11. maflcko commented at 10:47 AM on August 29, 2023: member

    The log should be emitter by bitcoind not bitcoin-cli? the cli is just a client

    Correct, you can find the debug.log in your data dir.

  12. vincenzopalazzo commented at 11:55 AM on August 29, 2023: none

    I will try to open a PR an add some more logging in this case because currently the log is useless for debugging this case

  13. bitcoin locked this on Aug 28, 2024

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-28 03:13 UTC

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