Skip to content
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

The Peer is Dead. Long live the ID #466

Merged
merged 38 commits into from
Dec 23, 2014
Merged

The Peer is Dead. Long live the ID #466

merged 38 commits into from
Dec 23, 2014

Conversation

jbenet
Copy link
Member

@jbenet jbenet commented Dec 21, 2014

This PR is a massive refactor, removing peer.Peer
everywhere and using peer.ID instead. This refactor
also revealed a number of bugs throughout that i
fixed. Sadly, i'm sure i'll introduce some-- this is
a pretty large refactor. The upside is that everything
is saner when it comes to peers and the peerstore.
They feel much better now.

Note: I will squash most of this PR so that it is
bisectable.

@maybebtc @whyrusleeping could use CR. multiple eyes
looking over it would be ideal.

@jbenet jbenet added the status/in-progress In progress label Dec 21, 2014
@jbenet
Copy link
Member Author

jbenet commented Dec 21, 2014

@maybebtc specifically, there's a test case inside bitswap/testnet that confusingly panics. help!

return nil, err
return
}
p = peer.PeerInfo{
Copy link
Contributor

Choose a reason for hiding this comment

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

why a PeerInfo rather than peerstore.Addresses(pid)?

Copy link
Member Author

Choose a reason for hiding this comment

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

i could switch it to peer.ID. i thought (id, addr) bundle was wanted, but turned out it wasn't. either way

@btc
Copy link
Contributor

btc commented Dec 21, 2014

Did this take care of #463 ?

@btc
Copy link
Contributor

btc commented Dec 21, 2014

@maybebtc specifically, there's a test case inside bitswap/testnet that confusingly panics. help!

Super confused by this. Digging deeper...

edit: a2f321f

if err := self.LoadAndVerifyKeyPair(skb); err != nil {
return nil, err
var id2 peer.ID
id2, err = peer.IDFromPrivateKey(sk)
Copy link
Contributor

Choose a reason for hiding this comment

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

is sk a bug? should it be sk2?

@jbenet
Copy link
Member Author

jbenet commented Dec 21, 2014

Did this take care of #463 ?

Not yet.

edit: I was planning on rebasing it on top of this.

@jbenet
Copy link
Member Author

jbenet commented Dec 21, 2014

Super confused by this. Digging deeper...
edit: a2f321f

👏 👏 👏

Hard to figure out what was wrong. :/ the lambdas made it hard to know where things were actually panicing.

// commenting out for now. i'm not sure this is correct -jbenet
// // TODO decide on providers. This probably shouldn't be happening.
// // TODO what did "this" mean? i think it's the notion of receiving
// // a list of providers and then immediately requesting that value
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, youre right on this. We can remove this code entirely

@whyrusleeping
Copy link
Member

Theres a lot of changes here, but skimming through it all, it looks pretty good to me.

@jbenet
Copy link
Member Author

jbenet commented Dec 22, 2014

Theres a lot of changes here, but skimming through it all, it looks pretty good to me.

this is one where careful look would be hugely valuable. a ton of important changes. @maybebtc already caught a couple errors, im sure I've made more. I'll look over it again, but more pairs of eyes would help.

@@ -102,8 +100,8 @@ func TestCanceledContext(t *testing.T) {
i := 0
go func() { // infinite stream
for {
peer := testutil.NewPeerWithIDString(string(i))
err := rs.Client(peer).Provide(context.Background(), k)
pi := peer.PeerInfo{ID: peer.ID(i)}
Copy link
Member

Choose a reason for hiding this comment

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

I know this is a refactor, but it looks like this isnt being cleaned up after

Copy link
Member Author

Choose a reason for hiding this comment

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

what do you mean? (not seeing it)

Copy link
Member

Choose a reason for hiding this comment

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

The infinite loop in a goroutine, that goroutine wont ever exit. which i guess is okay for tests, but they do build up when you do go test ./...

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, good catch, thanks 4b15204

@whyrusleeping
Copy link
Member

filing a complaint against the title, should be "The Peer is dead, Long live the Peer!"

@whyrusleeping
Copy link
Member

Alright, read over it all. It does all look pretty good with the changes youve made.

@btc
Copy link
Contributor

btc commented Dec 23, 2014

Would you be down to squash this so everything builds?

@jbenet
Copy link
Member Author

jbenet commented Dec 23, 2014

@maybebtc not everything, but yes the non building things.

@jbenet
Copy link
Member Author

jbenet commented Dec 23, 2014

@maybebtc help me fix the test first though -- oh damn i've been posting on the wrong issue. #463 (comment) should be here

Reproduced here:


Now i'm getting this.

client_1    | 06:00:10.279 DEBUG        dht: Run query with 0 peers. query.go:110
client_1    | 06:00:10.279 WARNI        dht: Running query with no peers! query.go:112```

Full log here: https://gist.github.com/jbenet/34db7858b7849153197f

Another interesting portion:

server_1    | 06:00:11.314 DEBUG  merkledag: DagService Add [QmQvvQQAH8gjFFDLhwXApUqJQxXK74x9kT3L8wxuKdAuE3] merkledag.go:188
server_1    | 06:00:11.315 DEBUG blockservi: blockservice: storing [QmQvvQQAH8gjFFDLhwXApUqJQxXK74x9kT3L8wxuKdAuE3] in datastore blockservice.go:44
server_1    | 06:00:11.325 DEBUG  merkledag: DagService Add [QmeWv547H72kytwg8KvBjeUgDonDhobhxZ5FqpQwV6dCo5] merkledag.go:188
server_1    | 06:00:11.325 DEBUG blockservi: blockservice: storing [QmeWv547H72kytwg8KvBjeUgDonDhobhxZ5FqpQwV6dCo5] in datastore blockserviStopping dockertest_server_1...
Stopping dockertest_data_1...
Stopping dockertest_bootstrap_1...
ce.go:44
server_1    | 06:00:11.333 DEBUG  merkledag: DagService Add [QmV6Lubap8eeGJP4ef34K4Q7X814p7sspUwxdpvttWRRmL] merkledag.go:188
server_1    | 06:00:11.334 DEBUG blockservi: blockservice: storing [QmV6Lubap8eeGJP4ef34K4Q7X814p7sspUwxdpvttWRRmL] in datastore blockservice.go:44
server_1    | 06:00:11.350 DEBUG  merkledag: DagService Add [QmQcYuUyhmNcRk6BTzhZ8cQdomipebz5BquboELLkafkaA] merkledag.go:188
serv

dockertest_data_1 and dockertest_bootstrap_1 stopped well before the server stops adding. the client dies much later, after the server is done, when its context expires.

@jbenet
Copy link
Member Author

jbenet commented Dec 23, 2014

the plot thickens, from the output it looks like the nodes aren't connecting.

@jbenet
Copy link
Member Author

jbenet commented Dec 23, 2014

Oh silliness, bitten by my own bug, i should be debugging on #463 as that fixes the bootstrapping. sec.

jbenet and others added 22 commits December 23, 2014 08:53
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
cc @jbenet @whyrusleeping

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
"Get" is still fairly useful. Leaving it there.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
https://build.protocol-dev.com/job/race/9352/console

@jbenet @whyrusleeping

pinging you guys to spread awareness about the delay.D type for
configurable delays

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
network.ListenAddresses() are general.
Interface addresses are specific.
Had to change the network interface from DialPeer(peer.ID) to
DialPeer(peer.PeerInfo), so that addresses of a provider are
handed to the network.

@maybebtc and I are discussing whether this should go all the
way down to the network, or whether the network _should always
work_ with just an ID (which means the network needs to be
able to resolve ID -> Addresses, using the routing system.
This latter point might mean that "routing" might need to
break down into subcomponents. It's a bit sketchy that
the Network would become smarter than just dial/listen and
I/O, but maybe there's a distinction between net.Network,
and something like a peernet.Network that has routing
built in...)
…outing

@jbenet @whyrusleeping

the next commit will change bitswap.Network.FindProviders to only deal
with IDs
@jbenet @whyrusleeping

This commit replaces peer.PeerInfo with peer.ID in the bitswap package
jbenet added a commit that referenced this pull request Dec 23, 2014
The Peer is Dead. Long live the ID
@jbenet jbenet merged commit 32589ad into master Dec 23, 2014
@jbenet jbenet removed the status/in-progress In progress label Dec 23, 2014
@jbenet jbenet deleted the peer-restrict branch December 23, 2014 17:44
@jbenet
Copy link
Member Author

jbenet commented Dec 23, 2014

Warning: the dht doesn't work. Merging this in as master already doesn't work (bootstrap bug). (please use the stable branch for an older commit on the old net that still works.)

To update you, @whyrusleeping tests pass, but the docker test doesn't. And, try spinning up three instances like below. resolving doesn't work, and not sure why.

ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
fix(dialqueue): fix a timer leak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants