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 🤷
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-
glozow commented at 6:46 PM on February 3, 2021: member
- glozow force-pushed on Feb 3, 2021
-
RandyMcMillan commented at 7:03 PM on February 3, 2021: contributor
This PR has a broader scope than docs - maybe add Utils/Log/Libs label or cli ?
- DrahtBot added the label Docs on Feb 3, 2021
-
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 droppedin 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 inactivityshould be changed toin the case of inactivitybecause 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);unknown changes_requestedlaanwj deleted a comment on Feb 3, 2021laanwj deleted a comment on Feb 3, 2021DrahtBot 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.
jnewbery commented at 10:07 AM on February 4, 2021: memberACK 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.
hebasto approvedhebasto commented at 12:00 PM on February 4, 2021: memberACK 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::InactivityCheckmuch better: https://github.com/bitcoin/bitcoin/blob/bf100f8170770544fb39ae6802175c564cde532f/src/net.cpp#L1225-L1229jnewbery commented at 12:15 PM on February 4, 2021: memberCurrently, 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)
MarcoFalke commented at 12:37 PM on February 4, 2021: memberAlso,
nConnectTimeoutis a global (bad!!) and could be a const member of connman insteadjnewbery commented at 12:52 PM on February 4, 2021: memberAlso, 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()orConnectSocketDirectly().In any case, I think we've wandered off topic a little bit :)
[doc] clarify -peertimeout and -timeout descriptions eecb7ab105glozow force-pushed on Feb 4, 2021glozow renamed this:doc: clarify -peertimeout
doc: clarify -timeout and -peertimeout config options
on Feb 4, 2021glozow marked this as ready for review on Feb 4, 2021MarcoFalke commented at 9:08 AM on February 5, 2021: memberACK eecb7ab105a4a59d09cd55b124c5ad563846fe11 nice doc fixup
jnewbery commented at 9:15 AM on February 5, 2021: memberACK eecb7ab105a4a59d09cd55b124c5ad563846fe11
MarcoFalke merged this on Feb 5, 2021MarcoFalke closed this on Feb 5, 2021glozow deleted the branch on Feb 5, 2021sidhujag referenced this in commit eb6d87c6e2 on Feb 5, 2021DrahtBot locked this on Aug 16, 2022Labels
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
More mirrored repositories can be found on mirror.b10c.me