asdine / storm

Simple and powerful toolkit for BoltDB
MIT License
2.06k stars 139 forks source link

fatal error: checkptr: unsafe pointer conversion #272

Closed ZaynJarvis closed 4 years ago

ZaynJarvis commented 4 years ago

in golang 1.14 [checkptr] is on by default, and when I run go test -race I got following error

fatal error: checkptr: unsafe pointer conversion

goroutine 12 [running]:
runtime.throw(0x62ce06e, 0x23)
/usr/local/go/src/runtime/panic.go:1112 +0x72 fp=0xc00051ef70 sp=0xc00051ef40 pc=0x4036e92
runtime.checkptrAlignment(0xc000572090, 0x617c840, 0x1)
/usr/local/go/src/runtime/checkptr.go:18 +0xb7 fp=0xc00051efa0 sp=0xc00051ef70 pc=0x40087c7
repo/vendor/go.etcd.io/bbolt.(*Bucket).write(0xc00051f118, 0x0, 0x0, 0x0)
/gopath/repo/vendor/go.etcd.io/bbolt/bucket.go:624 +0x15c fp=0xc00051f008 sp=0xc00051efa0 pc=0x431048c
repo/vendor/go.etcd.io/bbolt.(*Bucket).CreateBucket(0xc0001fa1d8, 0xc000196e00, 0xa, 0x10, 0xc000196e00, 0x62a447a, 0xa)
/gopath/repo/vendor/go.etcd.io/bbolt/bucket.go:181 +0x465 fp=0xc00051f1c8 sp=0xc00051f008 pc=0x430c8d5
repo/vendor/go.etcd.io/bbolt.(*Bucket).CreateBucketIfNotExists(0xc0001fa1d8, 0xc000196e00, 0xa, 0x10, 0xa, 0x10, 0x0)
/gopath/repo/vendor/go.etcd.io/bbolt/bucket.go:199 +0x5e fp=0xc00051f230 sp=0xc00051f1c8 pc=0x430cc7e
repo/vendor/go.etcd.io/bbolt.(*Tx).CreateBucketIfNotExists(...)
/gopath/repo/vendor/go.etcd.io/bbolt/tx.go:115
repo/vendor/github.com/asdine/storm/v3.(*node).CreateBucketIfNotExists(0xc0003e2000, 0xc0001fa1c0, 0x62a447a, 0xa, 0xc0002c03b8, 0x406d04c, 0x408751f)
/gopath/repo/vendor/github.com/asdine/storm/v3/bucket.go:20 +0x263 fp=0xc00051f2d0 sp=0xc00051f230 pc=0x438eec3
repo/vendor/github.com/asdine/storm/v3.(*node).setBytes(0xc0003e2000, 0xc0001fa1c0, 0x62a447a, 0xa, 0xc000196dc8, 0x7, 0x8, 0xc000196dc0, 0x7, 0x8, ...)
/gopath/repo/vendor/github.com/asdine/storm/v3/kv.go:77 +0x67 fp=0xc00051f350 sp=0xc00051f2d0 pc=0x4398787
repo/vendor/github.com/asdine/storm/v3.(*node).SetBytes.func1(0xc0001fa1c0, 0x0, 0x4035166)
/gopath/repo/vendor/github.com/asdine/storm/v3/kv.go:72 +0x9b fp=0xc00051f3d0 sp=0xc00051f350 pc=0x43ab42b
repo/vendor/github.com/asdine/storm/v3.(*node).readWriteTx.func2(0xc0001fa1c0, 0xc000196d01, 0xc0001fa1c0)
/gopath/repo/vendor/github.com/asdine/storm/v3/node.go:113 +0x47 fp=0xc00051f408 sp=0xc00051f3d0 pc=0x43ab987
repo/vendor/go.etcd.io/bbolt.(*DB).Update(0xc0002c0200, 0xc00051f500, 0x0, 0x0)
/gopath/repo/vendor/go.etcd.io/bbolt/db.go:694 +0xec fp=0xc00051f4b0 sp=0xc00051f408 pc=0x431a57c
repo/vendor/github.com/asdine/storm/v3.(*node).readWriteTx(0xc0003e2000, 0xc0002840a0, 0x6606440, 0xc000042100)
/gopath/repo/vendor/github.com/asdine/storm/v3/node.go:112 +0x1c9 fp=0xc00051f520 sp=0xc00051f4b0 pc=0x439a929
repo/vendor/github.com/asdine/storm/v3.(*node).SetBytes(0xc0003e2000, 0x62a447a, 0xa, 0x5fc1180, 0x65b0950, 0xc000196dc0, 0x7, 0x8, 0xa, 0xc000196da0)
/gopath/repo/vendor/github.com/asdine/storm/v3/kv.go:71 +0x226 fp=0xc00051f5d0 sp=0xc00051f520 pc=0x43985d6
repo/vendor/github.com/asdine/storm/v3.(*node).Set(0xc0003e2000, 0x62a447a, 0xa, 0x5fc1180, 0x65b0950, 0x5fc1180, 0x65b0960, 0x65d37a0, 0xc000074670)
/gopath/repo/vendor/github.com/asdine/storm/v3/kv.go:125 +0x9a fp=0xc00051f650 sp=0xc00051f5d0 pc=0x4398d3a
repo/vendor/github.com/asdine/storm/v3.(*DB).checkVersion(0xc000446bc0, 0x46, 0x180)
/gopath/repo/vendor/github.com/asdine/storm/v3/storm.go:98 +0x195 fp=0xc00051f6d0 sp=0xc00051f650 pc=0x43a95a5
repo/vendor/github.com/asdine/storm/v3.Open(0xc000294280, 0x46, 0x0, 0x0, 0x0, 0x7, 0xa, 0x1000a)
/gopath/repo/vendor/github.com/asdine/storm/v3/storm.go:65 +0x41d fp=0xc00051f7d0 sp=0xc00051f6d0 pc=0x43a8fcd
repo/internal/datastore.NewStormDB(0xc000294280, 0x46, 0xc00022d900, 0x3e, 0xc000294050, 0x4a)
/gopath/repo/internal/datastore/storm_db.go:13 +0x6f fp=0xc00051f860 sp=0xc00051f7d0 pc=0x44a18ef
repo/internal/datastore.NewDB(...)
/gopath/repo/internal/datastore/db.go:63
repo/internal/server.prepareAPI(0xc00025e360, 0xc00022d900, 0x3e)
/gopath/repo/internal/server/server_test.go:40 +0x14b fp=0xc00051fcf8 sp=0xc00051f860 pc=0x5e7b94b
repo/internal/server.TestDevice(0xc00025e360)
/gopath/repo/internal/server/server_test.go:91 +0xe6 fp=0xc00051fed0 sp=0xc00051fcf8 pc=0x5e7c6e6
testing.tRunner(0xc00025e360, 0x6372658)
/usr/local/go/src/testing/testing.go:992 +0x1ec fp=0xc00051ffd0 sp=0xc00051fed0 pc=0x419692c
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00051ffd8 sp=0xc00051ffd0 pc=0x406b351
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1043 +0x661

goroutine 1 [chan receive]:
testing.(*T).Run(0xc00012e5a0, 0x62a42ae, 0xa, 0x6372658, 0x1)
/usr/local/go/src/testing/testing.go:1044 +0x699
testing.runTests.func1(0xc00012e5a0)
/usr/local/go/src/testing/testing.go:1285 +0xa7
testing.tRunner(0xc00012e5a0, 0xc00069fce8)
/usr/local/go/src/testing/testing.go:992 +0x1ec
testing.runTests(0xc00000e780, 0x78b64a0, 0x3, 0x3, 0x0)
/usr/local/go/src/testing/testing.go:1283 +0x528
testing.(*M).Run(0xc000610a00, 0x0)
/usr/local/go/src/testing/testing.go:1200 +0x300
main.main()
_testmain.go:108 +0x338

goroutine 6 [chan receive]:
repo/vendor/k8s.io/klog.(*loggingT).flushDaemon(0x78e8980)
/gopath/repo/vendor/k8s.io/klog/klog.go:1010 +0xae
created by repo/vendor/k8s.io/klog.init.0
/gopath/repo/vendor/k8s.io/klog/klog.go:411 +0x18f

any help to resolve this issue?

asdine commented 4 years ago

Can you share your go.mod and go.sum file please?

ZaynJarvis commented 4 years ago

I am using without go module

asdine commented 4 years ago

In that case, make sure your go.etcd.io/bbolt dependency is up to date

ZaynJarvis commented 4 years ago

OK noted, thanks

ZaynJarvis commented 4 years ago

solved by updating bbolt.