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

Race in replica.go #129

Open
charl opened this issue Jun 24, 2014 · 1 comment
Open

Race in replica.go #129

charl opened this issue Jun 24, 2014 · 1 comment

Comments

@charl
Copy link

charl commented Jun 24, 2014

To run the demo as described I added the -race flag and I end up with the following trace when starting the first node:

$ ./demo -id=0
====== Spawn new replica ======
Done!
Wait 1 seconds to start
====== start ======
==================
WARNING: DATA RACE
Write by goroutine 8:
  github.com/go-distributed/epaxos/replica.(*Replica).updateMaxInstanceNum()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:623 +0x153
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:426 +0x9c
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Previous read by goroutine 11:
  github.com/go-distributed/epaxos/replica.(*Replica).checkTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:290 +0x20e
  github.com/go-distributed/epaxos/replica.(*Replica).timeoutLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:280 +0xff

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 11 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:257 +0x97
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Write by goroutine 8:
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:439 +0x57e
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Previous read by goroutine 9:
  github.com/go-distributed/epaxos/replica.(*Replica).findAndExecute()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:644 +0x329
  github.com/go-distributed/epaxos/replica.(*Replica).executeLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:329 +0xff

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 9 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:255 +0x67
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Read by goroutine 9:
  github.com/go-distributed/epaxos/replica.(*Replica).findAndExecute()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:652 +0x3e6
  github.com/go-distributed/epaxos/replica.(*Replica).executeLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:329 +0xff

Previous write by goroutine 8:
  github.com/go-distributed/epaxos/replica.NewInstance()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:136 +0x1f6
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:439 +0x48c
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Goroutine 9 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:255 +0x67
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Read by goroutine 11:
  github.com/go-distributed/epaxos/replica.(*Instance).inactiveDuaration()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:1091 +0x65
  github.com/go-distributed/epaxos/replica.(*Instance).isTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:1098 +0x6d
  github.com/go-distributed/epaxos/replica.(*Replica).checkTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:294 +0x34f
  github.com/go-distributed/epaxos/replica.(*Replica).timeoutLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:280 +0xff

Previous write by goroutine 8:
  github.com/go-distributed/epaxos/replica.(*Instance).touch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:1087 +0x65
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:447 +0x7e1
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Goroutine 11 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:257 +0x97
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Read by goroutine 11:
  github.com/go-distributed/epaxos/replica.(*Instance).isTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:1098 +0x8b
  github.com/go-distributed/epaxos/replica.(*Replica).checkTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:294 +0x34f
  github.com/go-distributed/epaxos/replica.(*Replica).timeoutLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:280 +0xff

Previous write by goroutine 8:
  github.com/go-distributed/epaxos/replica.NewInstance()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:136 +0x1f6
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:439 +0x48c
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Goroutine 11 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:257 +0x97
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Write by goroutine 10:
  github.com/go-distributed/epaxos/replica.(*Replica).batchPropose()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:398 +0x56d
  github.com/go-distributed/epaxos/replica.(*Replica).proposeLoopWithoutBatching()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:366 +0x26e
  github.com/go-distributed/epaxos/replica.(*Replica).proposeLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:340 +0x6a

Previous read by goroutine 8:
  github.com/go-distributed/epaxos/replica.(*Replica).Pack()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:925 +0x1c5
  github.com/go-distributed/epaxos/replica.(*Replica).StoreReplica()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:948 +0x86
  github.com/go-distributed/epaxos/replica.(*Replica).updateMaxInstanceNum()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:626 +0x1bc
  github.com/go-distributed/epaxos/replica.(*Replica).initInstance()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:559 +0x573
  github.com/go-distributed/epaxos/replica.(*Instance).handlePropose()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:492 +0x157
  github.com/go-distributed/epaxos/replica.(*Instance).nilStatusProcess()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/instance.go:257 +0x7d1
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:458 +0xc13
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Goroutine 10 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:256 +0x7f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================
==================
WARNING: DATA RACE
Read by goroutine 11:
  github.com/go-distributed/epaxos/replica.(*Replica).checkTimeout()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:294 +0x2df
  github.com/go-distributed/epaxos/replica.(*Replica).timeoutLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:280 +0xff

Previous write by goroutine 8:
  github.com/go-distributed/epaxos/replica.(*Replica).dispatch()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:439 +0x57e
  github.com/go-distributed/epaxos/replica.(*Replica).eventLoop()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:317 +0x117

Goroutine 11 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:257 +0x97
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee

Goroutine 8 (running) created at:
  github.com/go-distributed/epaxos/replica.(*Replica).Start()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/replica/replica.go:254 +0x4f
  main.main()
      /home/charl/Projects/go/src/github.com/go-distributed/epaxos/demo/server.go:93 +0x9ee
==================

My environment:

$ go version
go version go1.3 linux/amd64
$ uname -a
Linux cm-x1c 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/
@xiang90
Copy link
Contributor

xiang90 commented Jun 24, 2014

@charl Thanks for reporting. We will fix this soon.

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

No branches or pull requests

2 participants