Skip to content

Investigate failures in -race tests #45

@swift1337

Description

@swift1337

Race detector makes tests fail accidentally. Apparently, there are concurrency issues in the unit test code. I couldn't reproduce them locally on the M3 Pro processor or another x86 machine.

Examples:

FAIL: keygen_test.go:225: TssECDSAKeygenTestSuite.TestGenerateNewKeyWithStop

keygen_test.go:277:
keygen_test.go:277:
keygen_test.go:277:
    c.Assert(blames, HasLen, 1)
... obtained []blame.Node = []blame.Node(nil)
... n int = 1

    c.Assert(blames, HasLen, 1)
... obtained []blame.Node = []blame.Node(nil)
... n int = 1

    c.Assert(blames, HasLen, 1)
... obtained []blame.Node = []blame.Node(nil)
... n int = 1
--- FAIL: TestSignatureNotifierBroadcastFirst (0.05s)
    signature_notifier_test.go:159: 
        	Error Trace:	/home/runner/work/go-tss/go-tss/keysign/signature_notifier_test.go:159
        	Error:      	map[string]*keysign.notifier{} does not contain "be691deff2fbb18564d1caf54b6a37bc9951363e3151eaf542fad0c8b881d8b6"
        	Test:       	TestSignatureNotifierBroadcastFirst
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x23b6f0f]
==================
WARNING: DATA RACE
Read at 0x00c002b94f28 by goroutine 11283:
  github.com/zeta-chain/go-tss/p2p.(*StreamMgr).ReleaseStream()
      /home/runner/work/go-tss/go-tss/p2p/stream_helper.go:53 +0x248
  github.com/zeta-chain/go-tss/p2p.(*Communication).ReleaseStream()
      /home/runner/work/go-tss/go-tss/p2p/communication.go:497 +0x144
  github.com/zeta-chain/go-tss/tss.(*Server).Keygen.func1()
      /home/runner/work/go-tss/go-tss/tss/keygen.go:70 +0xef
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.22.12/x64/src/runtime/panic.go:602 +0x5d
  github.com/zeta-chain/go-tss/tss.(*FourNodeScaleZetaSuite).doTestKeygen.func1()
      /home/runner/work/go-tss/go-tss/tss/tss_4nodes_zeta_test.go:118 +0x344
  github.com/zeta-chain/go-tss/tss.(*FourNodeScaleZetaSuite).doTestKeygen.gowrap1()
      /home/runner/work/go-tss/go-tss/tss/tss_4nodes_zeta_test.go:123 +0x41

Previous write at 0x00c002b94f28 by goroutine 15257:
  github.com/zeta-chain/go-tss/p2p.(*StreamMgr).AddStream()
      /home/runner/work/go-tss/go-tss/p2p/stream_helper.go:77 +0x1d0
  github.com/zeta-chain/go-tss/p2p.(*Communication).writeToStream.func1()
      /home/runner/work/go-tss/go-tss/p2p/communication.go:151 +0x84
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.22.12/x64/src/runtime/panic.go:602 +0x5d
  github.com/zeta-chain/go-tss/p2p.(*Communication).broadcastToPeers.func2()
      /home/runner/work/go-tss/go-tss/p2p/communication.go:129 +0x124
  github.com/zeta-chain/go-tss/p2p.(*Communication).broadcastToPeers.gowrap2()
      /home/runner/work/go-tss/go-tss/p2p/communication.go:132 +0x4f

Goroutine 11283 (running) created at:
  github.com/zeta-chain/go-tss/tss.(*FourNodeScaleZetaSuite).doTestKeygen()
      /home/runner/work/go-tss/go-tss/tss/tss_4nodes_zeta_test.go:115 +0xda
  github.com/zeta-chain/go-tss/tss.(*FourNodeScaleZetaSuite).SetUpSuite()
      /home/runner/work/go-tss/go-tss/tss/tss_4nodes_zeta_test.go:84 +0x8cb
  runtime.call16()
      /opt/hostedtoolcache/go/1.22.12/x64/src/runtime/asm_amd64.s:770 +0x42
  reflect.Value.Call()
      /opt/hostedtoolcache/go/1.22.12/x64/src/reflect/value.go:380 +0xb5
  gopkg.in/check%2ev1.(*suiteRunner).runFixture.func1()
      /home/runner/go/pkg/mod/gopkg.in/[email protected]/check.go:724 +0x164
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/runner/go/pkg/mod/gopkg.in/[email protected]/check.go:[669](https://github.com/zeta-chain/go-tss/actions/runs/13897897767/job/38882616900#step:4:670) +0xe9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions