Ethan Buchman
443854222c
Merge pull request #852 from tendermint/net-conn-SetDeadline-wraps
p2p: use fake net.Pipe since only >=Go1.10 implements SetDeadline
7 years ago
Emmanuel Odeke
283544c7f3
p2p: use fake net.Pipe since only >=Go1.10 implements SetDeadline
Fixes https://github.com/tendermint/tendermint/issues/851
Go1.9 and below's net.Pipe did not implement the SetDeadline
method so after commit
e2dd8ca946
this problem was exposed since now we check for errors.
To counter this problem, implement a simple composition for
net.Conn that always returns nil on SetDeadline instead of
tripping out.
Added build tags so that anyone using go1.10 when it is released
will be able to automatically use net.Pipe's net.Conns
7 years ago
Ethan Buchman
49faa79bdc
Merge pull request #848 from tendermint/p2p-catch-conn.SetDeadline-errors
p2p: peer should respect errors from SetDeadline
7 years ago
Ethan Buchman
7670049a31
Merge pull request #845 from tendermint/fix/826-wait-for-rpc
rpc: wait for rpc servers to be available in tests
7 years ago
Ethan Buchman
0cd642bca7
Merge pull request #849 from tendermint/846-fix-TestFullRound1-race
fix TestFullRound1 race (Refs #846 )
7 years ago
Anton Kaliaev
fe3c92ecce
unescape $NODE_FLAGS (see comment)
7 years ago
Ethan Buchman
a969e24177
crank context timeouts
7 years ago
Emmanuel Odeke
7b0fa6c889
p2p: peer should respect errors from SetDeadline
Noticed while auditing the code that we aren't respecting
(*net.Conn) SetDeadline errors which return after
a connection has been killed and is simultaneously
being used.
For example given program, without SetDeadline error checks
```go
package main
import (
"log"
"net"
"time"
)
func main() {
conn, err := net.Dial("tcp", "tendermint.com:443")
if err != nil {
log.Fatal(err)
}
go func() {
<-time.After(400 * time.Millisecond)
conn.Close()
}()
for i := 0; i < 5; i++ {
if err := conn.SetDeadline(time.Now().Add(time.Duration(10 * time.Second))); err != nil {
log.Fatalf("set deadline #%d, err: %v", i, err)
}
log.Printf("Successfully set deadline #%d", i)
<-time.After(150 * time.Millisecond)
}
}
```
erraneously gives
```shell
2017/11/14 17:46:28 Successfully set deadline #0
2017/11/14 17:46:29 Successfully set deadline #1
2017/11/14 17:46:29 Successfully set deadline #2
2017/11/14 17:46:29 Successfully set deadline #3
2017/11/14 17:46:29 Successfully set deadline #4
```
However, if we properly fix it to respect that error with
```diff
--- wild.go 2017-11-14 17:44:38.000000000 -0700
+++ main.go 2017-11-14 17:45:40.000000000 -0700
@@ -16,7 +16,9 @@
conn.Close()
}()
for i := 0; i < 5; i++ {
- conn.SetDeadline(time.Now().Add(time.Duration(10 * time.Second)))
+ if err := conn.SetDeadline(time.Now().Add(time.Duration(10 *
time.Second))); err != nil {
+ log.Fatalf("set deadline #%d, err: %v", i, err)
+ }
log.Printf("Successfully set deadline #%d", i)
<-time.After(150 * time.Millisecond)
}
```
properly catches any problems and gives
```shell
$ go run main.go
2017/11/14 17:43:44 Successfully set deadline #0
2017/11/14 17:43:45 Successfully set deadline #1
2017/11/14 17:43:45 Successfully set deadline #2
2017/11/14 17:43:45 set deadline #3 , err: set tcp 10.182.253.51:57395:
use of closed network connection
exit status 1
```
7 years ago
Anton Kaliaev
fa60d8120e
fix TestFullRound1 race (Refs #846 )
```
==================
WARNING: DATA RACE
Write at 0x00c42d7605f0 by goroutine 844:
github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:465 +0x59e
I[11-14|22:37:28.781] Added to prevote vote="Vote{0:646753DCE124 1/02/1(Prevote) E9B19636DCDB {/CAD5FA805E8C.../}}" prevotes="VoteSet{H:1 R:2 T:1 +2/3:<nil> BA{2:X_} map[]}"
github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1229 +0x16a9
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1135 +0x721
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1087 +0x153
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1114 +0xa34
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1423 +0xdd6
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1317 +0x77
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:565 +0x7a9
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:523 +0x6d2
Previous read at 0x00c42d7605f0 by goroutine 654:
github.com/tendermint/tendermint/consensus.validatePrevote()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/common_test.go:149 +0x57
github.com/tendermint/tendermint/consensus.TestFullRound1()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state_test.go:256 +0x3c5
testing.tRunner()
/usr/local/go/src/testing/testing.go:746 +0x16c
Goroutine 844 (running) created at:
github.com/tendermint/tendermint/consensus.(*ConsensusState).startRoutines()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:258 +0x8c
github.com/tendermint/tendermint/consensus.startTestRound()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/common_test.go:118 +0x63
github.com/tendermint/tendermint/consensus.TestFullRound1()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state_test.go:247 +0x1fb
testing.tRunner()
/usr/local/go/src/testing/testing.go:746 +0x16c
Goroutine 654 (running) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:789 +0x568
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1004 +0xa7
testing.tRunner()
/usr/local/go/src/testing/testing.go:746 +0x16c
testing.runTests()
/usr/local/go/src/testing/testing.go:1002 +0x521
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:921 +0x206
main.main()
github.com/tendermint/tendermint/consensus/_test/_testmain.go:106 +0x1d3
==================
```
7 years ago
Ethan Buchman
e69d36d54f
some more robust sleeps
7 years ago
Ethan Buchman
844c43e044
use stdlib context
7 years ago
Ethan Buchman
194712fd3b
rpc: wait for rpc servers to be available in tests
7 years ago
Ethan Buchman
30f675aafa
Merge pull request #839 from tendermint/bugfix/pubsub-failures
Fix nondeterministic tests failures related to pubsub
7 years ago
Ethan Buchman
695266e907
Merge pull request #844 from tendermint/bunch-up-p2p.AddrBook-wg-calls
p2p: comment on the wg.Add before go saveRoutine()
7 years ago
Ethan Buchman
3db44dacae
Merge pull request #840 from tendermint/fix/tests
Fix/tests
7 years ago
Emmanuel Odeke
62c1bc0a20
p2p: comment on the wg.Add before go saveRoutine()
Just noticed while auditing the code in p2p/addrbook.go,
wg.Add(1) but no subsequent defer.
@jaekwon and I had a discussion offline and we agreed to
comment about why the code was that way and why
we shouldn't move the wg.Add(1) into .saveRoutine() because
if go a.saveRoutine() isn't started before anyone invokes
a.Wait(), then we'd have raced a.saveRoutine().
7 years ago
Ethan Buchman
238e2b72ee
Merge pull request #834 from tendermint/829-enable-logs-by-default
Enable logs by default
7 years ago
Ethan Buchman
a65ab3b0e0
Merge pull request #838 from tendermint/docker
docker update || 0.12.0
7 years ago
Ethan Buchman
aba8a8f4fc
consensus: crank timeout in timeoutWaitGroup
7 years ago
Ethan Buchman
0448c2b437
consensus: fix LastCommit log
7 years ago
Ethan Buchman
0ada0cf525
certifiers: test uses WaitForHeight
7 years ago
Anton Kaliaev
7fa12662c4
check whatever we can read from the channel
```
panic: interface conversion: interface {} is nil, not types.TMEventData
goroutine 7690 [running]:
github.com/tendermint/tendermint/consensus.waitForAndValidateBlock.func1(0xc427727620, 0x3)
/go/src/github.com/tendermint/tendermint/consensus/reactor_test.go:292 +0x62b
created by github.com/tendermint/tendermint/consensus.timeoutWaitGroup
/go/src/github.com/tendermint/tendermint/consensus/reactor_test.go:349 +0xa4
exit status 2
FAIL github.com/tendermint/tendermint/consensus 38.614s
```
7 years ago
Anton Kaliaev
bc9c4e8dee
update readme [ci skip]
7 years ago
Anton Kaliaev
8004af2519
update docker readme
7 years ago
Anton Kaliaev
21e87ebc11
update Go version to 1.9.2
7 years ago
Anton Kaliaev
70d8afa6e9
update Dockerfile
7 years ago
Ethan Buchman
847f865438
Merge pull request #836 from tendermint/fix/tests
consensus: make mempool_test deterministic
7 years ago
Ethan Buchman
2cda777900
consensus: make mempool_test deterministic
7 years ago
Anton Kaliaev
432a7276e2
[test_integrations] enable logs from peers by default (Refs #829 )
7 years ago
Anton Kaliaev
533f7c45eb
fix bash linter warnings for atomic_broadcast integration test
7 years ago
Anton Kaliaev
a1cdc2b68a
set logger for peer's MConnection
7 years ago
Ethan Buchman
9c4d533695
Merge pull request #833 from tendermint/fix/consensus-tests
consensus: fix for initializing block parts during catchup
7 years ago
Anton Kaliaev
ad03491ee6
remove duplicated key
7 years ago
Ethan Buchman
4b9dfc8990
consensus: fix for initializing block parts during catchup
7 years ago
Ethan Buchman
a46f64cd1e
Merge pull request #824 from tendermint/bugfix/node_test
rewrite node test to use new pubsub
7 years ago
Anton Kaliaev
b1e7163689
rewrite node test to use new pubsub
7 years ago
Ethan Buchman
c931279960
p2p: some fixes re @odeke-em issues #813,#816,#817
7 years ago
Ethan Buchman
12b25fdf6e
blockchain: add comment in AddPeer. closes #666
7 years ago
Ethan Buchman
c0e2649ed6
Merge pull request #788 from tendermint/feature/548-indexing-tags
new pubsub package
7 years ago
Ethan Buchman
593c127257
rpc/lib/types: RPCResponse.Result is not a pointer
7 years ago
Ethan Buchman
9f6a09277e
Merge pull request #812 from tendermint/808-make-connected-switches
MakeConnectedSwitches: connect first switch to others
7 years ago
Ethan Buchman
dd47884661
Merge pull request #820 from tendermint/790-use-tickers-instead-of-time-Sleep
prefer tickers to time.Sleep
7 years ago
Anton Kaliaev
a01c226dc4
wsConnection: call onDisconnect
7 years ago
Ethan Buchman
47f5e37205
copy RoundState for event
7 years ago
Petabyte Storage
51c9211cf4
add test for MConnection TrySend and Send
7 years ago
Anton Kaliaev
7869e541f6
change MakeConnectedSwitches to not connect to itself
and a test for it
7 years ago
Anton Kaliaev
e0daca5693
fixes from Bucky's review
7 years ago
Ethan Buchman
e8e512f1fa
Merge pull request #815 from tendermint/p2p-readme-tests
P2P: readme and tests
7 years ago
Ethan Buchman
37ce171061
p2p/connetion: remove panics, test error cases
7 years ago
Ethan Buchman
e01986e2b3
p2p: update readme, some minor things
7 years ago