BIP155 CJDNS address with length 187 (should be 16) #25874

issue AlonsoJara openend this issue on August 19, 2022
  1. AlonsoJara commented at 3:04 pm on August 19, 2022: none

    Bitcoin Status Error. I receive the following log:

    0022-08-18T17:27:38Z Shutdown: done
    12022-08-18T17:27:38Z scheduler thread exit
    22022-08-18T17:27:38Z Shutdown: In progress...
    32022-08-18T17:27:38Z Error: Invalid or corrupt peers.dat (BIP155 CJDNS address with length 187 (should be 16): iostream error). If you believe this is a bug, please report it to https://github.com/bitcoin/bitcoin/issues. As a workaround, you can move the file ("/home/bitcoin/.bitcoin/peers.dat") out of the way (rename, move, or delete) to have a new one created on the next start.
    
  2. fanquake added the label P2P on Aug 19, 2022
  3. fanquake renamed this:
    Bitcoin Status Error. I receive the following log: 2022-08-18T17:27:38Z Shutdown: done 2022-08-18T17:27:38Z scheduler thread exit 2022-08-18T17:27:38Z Shutdown: In progress... 2022-08-18T17:27:38Z Error: Invalid or corrupt peers.dat (BIP155 CJDNS address with length 187 (should be 16): iostream error). If you believe this is a bug, please report it to https://github.com/bitcoin/bitcoin/issues. As a workaround, you can move the file ("/home/bitcoin/.bitcoin/peers.dat") out of the way (rename, move, or delete) to have a new one created on the next start.
    BIP155 CJDNS address with length 187 (should be 16)
    on Aug 19, 2022
  4. fanquake commented at 3:21 pm on August 19, 2022: member
  5. MarcoFalke commented at 3:36 pm on August 19, 2022: member
    Is this still an issue with a recent version of Bitcoin Core? If yes, what are the steps to reproduce?
  6. jonatack commented at 5:41 pm on August 19, 2022: contributor

    Support for CJDNS was merged in November 2021 and released in Bitcoin Core v23 (the most recent release), and I don’t recall any (expected) changes to our CJDNS support since the v23 release.

    BIP155 CJDNS address with length <x> (should be <y>) is an error you would see if your node deserializes an invalid CJDNS address from a peer.

    However, Invalid or corrupt peers.dat (<reason>) would be invoked at bitcoind startup when loading the addresses from peers.dat, not at shutdown.

    I run a node for testing purposes that usually serves all our networks (clearnet, tor, i2p, and cjdns) and always has a few CJDNS peer connections but haven’t yet encountered this error in the wild.

    • I presume you saw this on mainnet? Apart from this, were you seeing valid connections with CJDNS peers? (you can check while your node is running using bitcoin-cli -netinfo 4 or bitcoin-cli getpeerinfo).

    • Was it with the v23 release (binary or built from source?), or current master, or? Which platform/OS?

    • Which version of CJDNS are you running (cjdns --version)?

  7. MarcoFalke added the label Waiting for author on Aug 19, 2022
  8. mzumsande commented at 6:04 pm on August 19, 2022: contributor

    However, Invalid or corrupt peers.dat () would be invoked at bitcoind startup when loading the addresses from peers.dat, not at shutdown.

    That’s probably what happened here, the shutdown was caused by an invalid peers.dat at startup, resulting in an early shutdown - it’s just that if multiple log messages have the exact same timestamp (“2022-08-18T17:27:38Z”), the order can be mixed up.

  9. MarcoFalke commented at 6:13 pm on August 19, 2022: member

    the order can be mixed up

    Can you add a reference to your claim? Locally I get the right order:

    02022-08-19T18:25:43Z init message: Loading P2P addresses…
    12022-08-19T18:25:43Z Error: Invalid or corrupt peers.dat ([...]
    22022-08-19T18:25:43Z Shutdown: In progress...
    32022-08-19T18:25:43Z scheduler thread exit
    42022-08-19T18:25:43Z Shutdown: done
    
  10. mzumsande commented at 6:23 pm on August 19, 2022: contributor

    Can you add a reference to your claim?

    I’m pretty sure I encountered this phenomenon on rare occasions in the past when looking at logs, but I don’t have any reference unfortunately, so this may also be bad memory/an oversight. In your example, there are two different timestamps (2022-08-19T18:11:32Z and 2022-08-19T18:11:43Z).

  11. jonatack commented at 6:30 pm on August 19, 2022: contributor
    Hm, it shouldn’t be possible for a peer to corrupt the peers.dat by sending us an invalid address (which would be a bug). Maybe a disk corruption error or the node didn’t shutdown properly?
  12. MarcoFalke commented at 6:31 pm on August 19, 2022: member

    there are two different timestamps

    Thanks, edited.

    For reference, logging has a lock, which is held until the timestamped log message is fully written and flushed. See https://github.com/bitcoin/bitcoin/blob/6b56873b41974ced7aad87a4b38abe360c34eed3/src/logging.cpp#L371

    Obviously if this may no longer hold if the logs are post-processed outside of vanilla Bitcoin Core.

  13. MarcoFalke commented at 6:44 am on August 20, 2022: member
    Closing for now due to lack of details. Can be reopened once they are there.
  14. MarcoFalke closed this on Aug 20, 2022

  15. bitcoin locked this on Aug 20, 2023

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: 2024-12-21 15:12 UTC

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