Skip to content

Fix the test case that often fails. #311

@egonspace

Description

@egonspace

Ostracon version (use ostracon version or git rev-parse --verify HEAD if installed from source):
latest

ABCI app (name for built-in, URL for self-written if it's publicly available):

Environment:

  • OS (e.g. from /etc/os-release):
  • Install tools:
  • Others:

What happened:
The following tests often fail in CI tests:

failed test case

--- FAIL: TestByzantinePrevoteEquivocation (30.14s)
    byzantine_test.go:285: Consensus Reactor 0
        ConsensusReactor
    byzantine_test.go:285: Consensus Reactor 1
        ConsensusReactor
    byzantine_test.go:285: Consensus Reactor 2
        ConsensusReactor
    byzantine_test.go:285: Consensus Reactor 3
        ConsensusReactor
    byzantine_test.go:287: Timed out waiting for validators to commit evidence
FAIL
coverage: 71.5% of statements
FAIL	github.com/line/ostracon/consensus	135.075s
--- FAIL: TestStartNextHeightCorrectlyAfterTimeout (0.63s)
panic: Timeout expired while waiting for NewBlockHeader event [recovered]
	panic: Timeout expired while waiting for NewBlockHeader event

goroutine 65933 [running]:
testing.tRunner.func1.2(0x1262940, 0x160d080)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1143 +0x49f
testing.tRunner.func1(0xc00d679680)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1146 +0x695
panic(0x1262940, 0x160d080)
	/opt/hostedtoolcache/go/1.16.7/x64/src/runtime/panic.go:971 +0x499
github.com/line/ostracon/consensus.ensureNewBlockHeader(0xc00918ea20, 0x1, 0xc0023158e0, 0x20, 0x20)
	/home/runner/work/ostracon/ostracon/consensus/common_test.go:661 +0x2e5
github.com/line/ostracon/consensus.TestStartNextHeightCorrectlyAfterTimeout(0xc00d679680)
	/home/runner/work/ostracon/ostracon/consensus/state_test.go:1760 +0xc7d
testing.tRunner(0xc00d679680, 0x1512310)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1193 +0x203
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1238 +0x5d8
FAIL	github.com/line/ostracon/consensus	78.018s
WARNING: DATA RACE
Write at 0x00c000f085c8 by goroutine 177:
  github.com/line/ostracon/blockchain/v0.TestBadBlockStopsPeer()
      /home/runner/work/ostracon/ostracon/blockchain/v0/reactor_test.go:264 +0xf58
  testing.tRunner()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1193 +0x202

Previous read at 0x00c000f085c8 by goroutine 634:
  [failed to restore the stack]

Goroutine 177 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1238 +0x5d7
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1511 +0xa6
  testing.tRunner()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1193 +0x202
  testing.runTests()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1509 +0x612
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1417 +0x3b3
  main.main()
      _testmain.go:101 +0x356

Goroutine 634 (running) created at:
  github.com/line/ostracon/blockchain/v0.(*BlockchainReactor).OnStart()
      /home/runner/work/ostracon/ostracon/blockchain/v0/reactor.go:116 +0x175
  github.com/line/ostracon/libs/service.(*BaseService).Start()
      /home/runner/work/ostracon/ostracon/libs/service/service.go:140 +0x55e
  github.com/line/ostracon/blockchain/v0.(*BlockchainReactor).Start()
      <autogenerated>:1 +0x44
  github.com/line/ostracon/p2p.(*Switch).OnStart()
      /home/runner/work/ostracon/ostracon/p2p/switch.go:227 +0x121
  github.com/line/ostracon/libs/service.(*BaseService).Start()
      /home/runner/work/ostracon/ostracon/libs/service/service.go:140 +0x55e
  github.com/line/ostracon/p2p.StartSwitches()
      /home/runner/work/ostracon/ostracon/p2p/test_util.go:168 +0x75
  github.com/line/ostracon/p2p.MakeConnectedSwitches()
      /home/runner/work/ostracon/ostracon/p2p/test_util.go:89 +0x189
  github.com/line/ostracon/blockchain/v0.TestBadBlockStopsPeer()
      /home/runner/work/ostracon/ostracon/blockchain/v0/reactor_test.go:229 +0xd37
  testing.tRunner()
      /opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1193 +0x202
==================
--- FAIL: TestBadBlockStopsPeer (42.05s)
    testing.go:1092: race detected during execution of test

(Failing tests will continue to be added here.)

What you expected to happen:

Have you tried the latest version: yes/no

How to reproduce it (as minimally and precisely as possible):

Logs (paste a small part showing an error (< 10 lines) or link a pastebin, gist, etc. containing more of the log file):

Config (you can paste only the changes you've made):

node command runtime flags:

Please provide the output from the http://<ip>:<port>/dump_consensus_state RPC endpoint for consensus bugs

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: bugClassification: Something isn't workingStaleFor github bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions