hashicorp / raft-mdb

LMDB backend for Raft
Mozilla Public License 2.0
134 stars 35 forks source link

panic: runtime error: cgo argument has Go pointer to Go pointer #6

Open zhengxiaochuan-3 opened 7 years ago

zhengxiaochuan-3 commented 7 years ago

go version: [root@node-65-76 nvme]# go version go version go1.8.1 linux/amd64

goroutine 62 [running, locked to thread]:
github.com/armon/gomdb.(*Txn).Put.func1(0x7fc0d8001df0, 0xc400000002, 0xc420164490, 0xc4201644a0, 0x0, 0x0)
    /home/go-project/src/github.com/armon/gomdb/txn.go:152 +0x8b
github.com/armon/gomdb.(*Txn).Put(0xc42062a050, 0x2, 0xc420164430, 0x8, 0x8, 0xc420ea6000, 0x4d, 0x81, 0x0, 0x0, ...)
    /home/go-project/src/github.com/armon/gomdb/txn.go:152 +0xec
github.com/hashicorp/raft-mdb.(*MDBStore).StoreLogs(0xc42000c8c0, 0xc42062a038, 0x1, 0x1, 0x1, 0x1)
    /home/go-project/src/github.com/hashicorp/raft-mdb/mdb_store.go:223 +0x229
github.com/hashicorp/raft.(*Raft).dispatchLogs(0xc420190600, 0xc42006dea8, 0x1, 0x1)
    /home/go-project/src/github.com/hashicorp/raft/raft.go:1149 +0x3a3
github.com/hashicorp/raft.(*Raft).runLeader(0xc420190600)
    /home/go-project/src/github.com/hashicorp/raft/raft.go:861 +0x68a
github.com/hashicorp/raft.(*Raft).run(0xc420190600)
    /home/go-project/src/github.com/hashicorp/raft/raft.go:635 +0x84
github.com/hashicorp/raft.(*Raft).(github.com/hashicorp/raft.run)-fm()
    /home/go-project/src/github.com/hashicorp/raft/raft.go:259 +0x2a
github.com/hashicorp/raft.(*raftState).goFunc.func1(0xc420190600, 0xc42061e450)
    /home/go-project/src/github.com/hashicorp/raft/state.go:146 +0x53
created by github.com/hashicorp/raft.(*raftState).goFunc
    /home/go-project/src/github.com/hashicorp/raft/state.go:147 +0x66
2017/08/14 11:58:30 [DEBUG] raft-net: 127.0.0.1:12001 accepted connection from: 127.0.0.1:58652
panic: runtime error: cgo argument has Go pointer to Go pointer
tylertreat commented 7 years ago

I just ran across the same issue. I think this library might need to be updated to work with newer versions of Go?

freeekanayaka commented 7 years ago

@tylertreat right, it violates cgo pointer rules rules, which have always been there but now have runtime checks in Go 1.8.

Can upstream make a comment on this? It seems this bug pretty much makes the lmdb backend for the raft package unusable with Go 1.8 (and the lmdb backend is the recommended one).

tylertreat commented 7 years ago

FWIW, it looks like Consul uses https://github.com/hashicorp/raft-boltdb for its Raft backend, so I wonder if that is the "recommended" one now.

freeekanayaka commented 7 years ago

@tylertreat if it's not anymore, I'd say the raft README should be updated:

"To prevent complications with cgo, the primary backend MDBStore is in a separate repository, called raft-mdb. That is the recommended implementation for the LogStore and StableStore."