-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net: don't retry failed oneshot connections forever #12329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1953,29 +1952,29 @@ void CConnman::ThreadOpenAddedConnections() | |||
} | |||
|
|||
// if successful, this moves the passed grant to the constructed node | |||
bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection) | |||
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to remove the return argument here? I think it's useful for it to be able to signal failure, for example to log an error, even if we don't use that at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is actually a really big help for the libevent code. This needs to be a one-way function so that it can be run async, with failures optionally triggering callbacks.
The oneshot reinsertion was the only thing preventing making that change trivially.
Edit: See here for that change on the libevent PR: 03e73a7. Notice the only thing the failed-connect callback does: 03e73a7#diff-9a82240fe7dfe86564178691cc57f2f1R2013
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, makes sense then
utACK 660f5f1 |
utACK 660f5f1 |
@sipa mentioned on IRC that these were originally retried because they may be tor seed attempts, which can only try one address, as opposed to normal seed resolves which may return a long list. So by not retrying these, if using tor, you only get seednode_count chances to make a connection and learn some new addresses. To avoid that, I think we should just re-run the entire ThreadDNSAddressSeed() as necessary until we have the desired connections. |
utACK 660f5f1 |
Let's leave that for a future PR, and take this fix for rc2. |
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) #11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd
Github-Pull: bitcoin#12329 Rebased-From: 660f5f1 Tree-SHA512: 7e7401b0ade3a2482dd246cc92c795230b37001a13fd7d050847ea532b619106dfdfc113e95c2891c689d421b3dd775d1833789061cd90dc094f13c4f5f6b278 Conflicts: src/net.cpp src/net.h
"As introduced by (my suggestion, sorry, in) #11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was." bitcoin/bitcoin#12329
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org>
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org>
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org>
660f5f1 net: don't retry failed oneshot connections forever (Cory Fields) Pull request description: As introduced by (my suggestion, sorry, in) bitcoin#11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves. Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it. Maybe @sipa can shed a light on what the original intention was. Tree-SHA512: 2dfe35dabfb6354c315cf6f8ae42971765d36575e685662caae7ed8f9dea9472c6fb1fd5e62ec35301550b74b6613a54265e90fca2a6618544f78dacaac4d4fd fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org> fix 12329 backport Signed-off-by: Pasta <pasta@dashboost.org>
As introduced by (my suggestion, sorry, in) #11512, failed dns resolves end up as oneshots. But failed oneshots are re-added as oneshots, so we need to make sure that we're not queuing these up forever after failed resolves.
Rather than trying to differentiate, I think we should just not re-add failed oneshots and be done with it.
Maybe @sipa can shed a light on what the original intention was.