doc: clarify -timeout and -peertimeout config options #21077

pull glozow wants to merge 1 commits into bitcoin:master from glozow:2021-02-peertimeout changing 1 files +2 −2
  1. glozow commented at 6:46 PM on February 3, 2021: member

    The debug-only option -peertimeout is used to delay InactivityCheck(), whereas the -timeout option specifies socket timeouts (nConnectTimeout). The current descriptions are a bit misleading and hard to tell apart. I think it would save dev/review time to update them 🤷

  2. glozow force-pushed on Feb 3, 2021
  3. RandyMcMillan commented at 7:03 PM on February 3, 2021: contributor

    @glozow

    This PR has a broader scope than docs - maybe add Utils/Log/Libs label or cli ?

  4. DrahtBot added the label Docs on Feb 3, 2021
  5. in src/init.cpp:458 in f2306cbb9f outdated
     454 | @@ -455,7 +455,7 @@ void SetupServerArgs(NodeContext& node)
     455 |      argsman.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
     456 |      argsman.AddArg("-networkactive", "Enable all P2P network activity (default: 1). Can be changed by the setnetworkactive RPC command", ArgsManager::ALLOW_BOOL, OptionsCategory::CONNECTION);
     457 |      argsman.AddArg("-timeout=<n>", strprintf("Specify connection timeout in milliseconds (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
     458 | -    argsman.AddArg("-peertimeout=<n>", strprintf("Specify p2p connection timeout in seconds. This option determines the amount of time a peer may be inactive before the connection to it is dropped. (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
    


    unknown commented at 7:41 PM on February 3, 2021:

    I don't like how you just removed p2p connection. It was good how it was.


    unknown commented at 7:46 PM on February 3, 2021:

    There was no issue with any of the text. It was written very clearly:

    Specify p2p connection timeout in seconds. This option determines the amount of time a peer may be inactive before the connection to it is dropped

  6. in src/init.cpp:458 in f2306cbb9f outdated
     454 | @@ -455,7 +455,7 @@ void SetupServerArgs(NodeContext& node)
     455 |      argsman.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
     456 |      argsman.AddArg("-networkactive", "Enable all P2P network activity (default: 1). Can be changed by the setnetworkactive RPC command", ArgsManager::ALLOW_BOOL, OptionsCategory::CONNECTION);
     457 |      argsman.AddArg("-timeout=<n>", strprintf("Specify connection timeout in milliseconds (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
     458 | -    argsman.AddArg("-peertimeout=<n>", strprintf("Specify p2p connection timeout in seconds. This option determines the amount of time a peer may be inactive before the connection to it is dropped. (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
     459 | +    argsman.AddArg("-peertimeout=<n>", strprintf("Specify a timeout delay in seconds. After connecting to a peer, wait this amount of time before deciding to disconnect based on inactivity. (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
    


    unknown commented at 7:41 PM on February 3, 2021:
        argsman.AddArg("-peertimeout=<n>", strprintf("Specify a timeout delay in seconds. After connecting to a peer, wait this amount of time before disconnecting based on inactivity. (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
    

    unknown commented at 7:54 PM on February 3, 2021:

    No matter how I look it, I don't like your version of the text @glozow.

    Even based on inactivity should be changed to in the case of inactivity because inactivity is not a fixed state on which you can base things, it is occurring randomly.

    Specify a connection timeout delay in seconds. After connecting to a peer, wait this amount of time before disconnecting in the case of inactivity. What connection? P2P...


    hebasto commented at 12:00 PM on February 4, 2021:

    nit: maybe drop the last full stop as done for most of the help strings?

        argsman.AddArg("-peertimeout=<n>", strprintf("Specify a timeout delay in seconds. After connecting to a peer, wait this amount of time before deciding to disconnect based on inactivity (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
    
  7. unknown changes_requested
  8. laanwj deleted a comment on Feb 3, 2021
  9. laanwj deleted a comment on Feb 3, 2021
  10. DrahtBot commented at 1:02 AM on February 4, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20721 (Net: Move ping data to net_processing by jnewbery)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  11. jnewbery commented at 10:07 AM on February 4, 2021: member

    ACK f2306cbb9f564815b015fdbdb80410299fd22dee although I agree with @ghost that "P2P" could be added back.

    There was no issue with any of the text. It was written very clearly @ghost: I disagree. The text as currently written states that if an p2p connection stops responding to messages for -peertimeout seconds, then we'll disconnect. This isn't what the config option does. It controls how long we'll wait after we connect before we start running inactivity checks. Those inactivity checks always use the hardcoded TIMEOUT_INTERVAL, which is 20 minutes.

  12. hebasto approved
  13. hebasto commented at 12:00 PM on February 4, 2021: member

    ACK f2306cbb9f564815b015fdbdb80410299fd22dee

    I see this PR as a kind of follow up of #20927.

    Currently, on master:

    $ src/bitcoind -help-debug | grep -A 2 -e '-timeout'
      -timeout=<n>
           Specify connection timeout in milliseconds (minimum: 1, default: 5000)
    
    $ src/bitcoind -help-debug | grep -A 4 -e '-peertimeout'
      -peertimeout=<n>
           Specify p2p connection timeout in seconds. This option determines the
           amount of time a peer may be inactive before the connection to it
           is dropped. (minimum: 1, default: 60)
    
    

    With this PR (f2306cbb9f564815b015fdbdb80410299fd22dee):

    $ src/bitcoind -help-debug | grep -A 4 -e '-peertimeout'
      -peertimeout=<n>
           Specify a timeout delay in seconds. After connecting to a peer, wait
           this amount of time before deciding to disconnect based on
           inactivity. (minimum: 1, default: 60)
    
    

    that describes the logic of CConnman::InactivityCheck much better: https://github.com/bitcoin/bitcoin/blob/bf100f8170770544fb39ae6802175c564cde532f/src/net.cpp#L1225-L1229

  14. jnewbery commented at 12:15 PM on February 4, 2021: member

    Currently, on master:

    $ src/bitcoind -help-debug | grep -A 2 -e '-timeout'
      -timeout=<n>
           Specify connection timeout in milliseconds (minimum: 1, default: 5000)```
    

    This config option is also under-documented! The timeout this is referring to is the socket timeout on initial connection (i.e. if poll or select don't return a file descriptor because the initial connection timed out)

  15. MarcoFalke commented at 12:37 PM on February 4, 2021: member

    Also, nConnectTimeout is a global (bad!!) and could be a const member of connman instead

  16. jnewbery commented at 12:52 PM on February 4, 2021: member

    Also, nConnectTimeout is a global (bad!!) and could be a const member of connman instead

    I'm not sure if connman is the right home for this. It's a low-level socket configuration, and could live entirely in netbase. It seems strange that connman takes a global from netbase.cpp and then passes it to netbase through ConnectThroughProxy() or ConnectSocketDirectly().

    In any case, I think we've wandered off topic a little bit :)

  17. [doc] clarify -peertimeout and -timeout descriptions eecb7ab105
  18. glozow force-pushed on Feb 4, 2021
  19. glozow renamed this:
    doc: clarify -peertimeout
    doc: clarify -timeout and -peertimeout config options
    on Feb 4, 2021
  20. glozow marked this as ready for review on Feb 4, 2021
  21. glozow commented at 9:26 PM on February 4, 2021: member

    Thanks @hebasto and @jnewbery for your kind and thoughtful feedback ☺️ I've addressed your comments and edited the -timeout help string a little bit so that they're more distinguishable.

  22. MarcoFalke commented at 9:08 AM on February 5, 2021: member

    ACK eecb7ab105a4a59d09cd55b124c5ad563846fe11 nice doc fixup

  23. jnewbery commented at 9:15 AM on February 5, 2021: member

    ACK eecb7ab105a4a59d09cd55b124c5ad563846fe11

  24. MarcoFalke merged this on Feb 5, 2021
  25. MarcoFalke closed this on Feb 5, 2021

  26. glozow deleted the branch on Feb 5, 2021
  27. sidhujag referenced this in commit eb6d87c6e2 on Feb 5, 2021
  28. DrahtBot locked this on Aug 16, 2022

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-22 18:14 UTC

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