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

[Demo] try go mod #91

Closed

Conversation

ChihChengLiang
Copy link
Collaborator

@ChihChengLiang ChihChengLiang commented Oct 25, 2018

What was wrong?

This is an attempt to fix #85 by using the Go mod approach.

How was it fixed?

By introducing go.mod and go.sum, the go mod download step in the dev.Dockerfile can cache the dependencies download, so no need to go get every time on codebase changes.

But there's an issue. The containers spun from the newly built images fails randomly when executing add_peer commands in Ansible scripts. The error message is:

dial attempt failed: connected to wrong peer. 

To reproduce this PR, one needs to

  • upgrade Go to 1.11
  • move the repo out of $GOPATH

Cute Animal Picture

image

@jrhea
Copy link
Contributor

jrhea commented Nov 16, 2018

@ChihChengLiang I am running go 1.11.1 and the repo is in my $GOPATH and I get this error occasionally when running from the CLI and no docker container:

Steps to reproduce:

Open a new terminal sesh and run

$ ./sharding-p2p-poc -seed=0 -port=10000 -rpcport=13000 &
[1] 27462
2018/11/16 16:18:17 Initializing logging reporter
16:18:17.752  INFO sharding-p: Node is listening: seed=0, addr=127.0.0.1:10000, peerID=QmS5QmciTXXnCUCyxud5eWFenUMAmvAWSDa1c7dvdXRMZ7 main.go:189
16:18:17.753  INFO sharding-p: RPC server listening to address: 127.0.0.1:13000 rpcserver.go:423

$ ./sharding-p2p-poc -seed=1 -port=10001 -rpcport=13001 &
[2] 27463
$ 2018/11/16 16:18:26 Initializing logging reporter
16:18:26.341  INFO sharding-p: Node is listening: seed=1, addr=127.0.0.1:10001, peerID=QmexAnfpHrhMmAC5UNQVS8iBuUUgDrMbMY17Cck2gKrqeX main.go:189
16:18:26.341  INFO sharding-p: RPC server listening to address: 127.0.0.1:13001 rpcserver.go:423

$ ./sharding-p2p-poc -seed=2 -port=10002 -rpcport=13002 &
[3] 27464
$ 2018/11/16 16:18:33 Initializing logging reporter
16:18:33.960  INFO sharding-p: Node is listening: seed=2, addr=127.0.0.1:10002, peerID=Qmd3wzD2HWA95ZAs214VxnckwkwM4GHJyC6whKUCNQhNvW main.go:189
16:18:33.960  INFO sharding-p: RPC server listening to address: 127.0.0.1:13002 rpcserver.go:423

Open another terminal sesh and run:

$ ./sharding-p2p-poc -port=10001 -rpcport=13001 -client addpeer 127.0.0.1 10000 0
16:20:28.108 CRITI sharding-p: Failed to add peer at 127.0.0.1:10000, err: rpc error: code = Unknown desc = Failed to connect to peer <peer.ID Qm*KoDARa>, err: dial attempt failed: <peer.ID Qm*gKrqeX> --> <peer.ID Qm*KoDARa> dial attempt failed: connected to wrong peer cli.go:136

You can see that we get an error, but if i run it again:

jonny@jonnys-MBP:$ ./sharding-p2p-poc -port=10001 -rpcport=13001 -client addpeer 127.0.0.1 10000 0
$ ./sharding-p2p-poc -port=10001 -rpcport=13001 -client listpeer
["QmS5QmciTXXnCUCyxud5eWFenUMAmvAWSDa1c7dvdXRMZ7"]

You can see that it worked.

I am thinking that it has something to go with the code running on go1.11.1.

I will trace through the code and investigate. If either @ChihChengLiang or @mhchia can confirm that it works on a previous version of Go...that might be a good lead.

@ChihChengLiang
Copy link
Collaborator Author

It works for me on the first try. I'm using go1.11.1.

Note that I've updated my environment with

go get -v ...
make deps # get latest gx
make partial-gx-rw
go build

@NIC619
Copy link
Collaborator

NIC619 commented Nov 17, 2018

@jrhea I believe it's related to #100 and I'm currently working on the fix right now. Sorry for the trouble.

@jrhea
Copy link
Contributor

jrhea commented Nov 18, 2018

@NIC619 ahhh... interesting. Let me know if you have a fix and I will test it. @ChihChengLiang I'll try your suggestion as well

@jrhea
Copy link
Contributor

jrhea commented Nov 19, 2018

@NIC619 your fix seemed to work.

@ChihChengLiang
Copy link
Collaborator Author

Closed in favor of #121

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.

Speed up docker build process
3 participants