Skip to content

Conversation

theuni
Copy link
Member

@theuni theuni commented Feb 1, 2018

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.

@laanwj laanwj added this to the 0.16.0 milestone Feb 1, 2018
@laanwj laanwj added the P2P label Feb 1, 2018
@@ -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)
Copy link
Member

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.

Copy link
Member Author

@theuni theuni Feb 1, 2018

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense then

@laanwj
Copy link
Member

laanwj commented Feb 1, 2018

utACK 660f5f1

@jonasschnelli
Copy link
Contributor

utACK 660f5f1

@theuni
Copy link
Member Author

theuni commented Feb 1, 2018

@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.

@achow101
Copy link
Member

achow101 commented Feb 1, 2018

utACK 660f5f1

@meshcollider
Copy link
Contributor

meshcollider commented Feb 2, 2018

@theuni To avoid that, I think we should just re-run the entire ThreadDNSAddressSeed() as necessary until we have the desired connections.

Are you going to do that in this PR or leave it for later?

utACK 660f5f1

@laanwj
Copy link
Member

laanwj commented Feb 2, 2018

Are you going to do that in this PR or leave it for later?

Let's leave that for a future PR, and take this fix for rc2.

laanwj pushed a commit that referenced this pull request Feb 2, 2018
Github-Pull: #12329
Rebased-From: 660f5f1
Tree-SHA512: 7e7401b0ade3a2482dd246cc92c795230b37001a13fd7d050847ea532b619106dfdfc113e95c2891c689d421b3dd775d1833789061cd90dc094f13c4f5f6b278
@laanwj laanwj merged commit 660f5f1 into bitcoin:master Feb 2, 2018
laanwj added a commit that referenced this pull request Feb 2, 2018
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
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Mar 16, 2018
Github-Pull: bitcoin#12329
Rebased-From: 660f5f1
Tree-SHA512: 7e7401b0ade3a2482dd246cc92c795230b37001a13fd7d050847ea532b619106dfdfc113e95c2891c689d421b3dd775d1833789061cd90dc094f13c4f5f6b278

Conflicts:
	src/net.cpp
	src/net.h
lyricidal added a commit to TheArcadiaGroup/DAPS that referenced this pull request Nov 17, 2019
"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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 26, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 26, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 26, 2020
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>
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 27, 2020
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>
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 27, 2020
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>
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 25, 2021
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>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants