hashicorp / raft-boltdb

Raft backend implementation using BoltDB
Mozilla Public License 2.0
653 stars 112 forks source link

Segfault in `BoltStore.Get()` #34

Closed haraldh closed 1 year ago

haraldh commented 1 year ago
/home/runner/go/pkg/mod/go.etcd.io/bbolt@v1.3.7/bucket.go:84                                                                                                                                                 
go.etcd.io/bbolt.(*Bucket).Get(0x0, {0xb56f320, 0xb, 0xb})                                                                                                                                                           
        /home/runner/go/pkg/mod/go.etcd.io/bbolt@v1.3.7/bucket.go:260 +0x2f                                                                                                                                          
github.com/hashicorp/raft-boltdb/v2.(*BoltStore).Get(0x6b12f3f?, {0xb56f320, 0xb, 0xb})                                                                                                                              
        /home/runner/go/pkg/mod/github.com/hashicorp/raft-boltdb/v2@v2.0.0-20210421194847-a7e34179d62c/bolt_store.go:245 +0xe5                                                                                       
github.com/hashicorp/raft-boltdb/v2.(*BoltStore).GetUint64(0x88f24020?, {0xb56f320?, 0x7eeeae8?, 0xb160d108?})                                                                                                       
        /home/runner/go/pkg/mod/github.com/hashicorp/raft-boltdb/v2@v2.0.0-20210421194847-a7e34179d62c/bolt_store.go:260 +0x1e                                                                                       
github.com/hashicorp/raft.HasExistingState({0x7f736d8, 0x88f162c0}, {0x7f6ab00?, 0x885e60d8?}, {0x7f544e0, 0x88f14750})                                                                                              
        /home/runner/go/pkg/mod/github.com/hashicorp/raft@v1.3.10/api.go:449 +0x63                                                                                                                                   
github.com/hashicorp/vault/physical/raft.(*RaftBackend).Bootstrap(0x88f30000, {0x8905cec0, 0x1, 0x57a4320?})                                                                                                         
        /home/runner/work/vault/vault/physical/raft/raft.go:749 +0xca                                                                                                                                                
github.com/hashicorp/vault/vault.(*Core).RaftBootstrap(0x88f4a000, {0x7f69980, 0x88118010}, 0x1)                                                                                                                     
        /home/runner/work/vault/vault/vault/raft.go:1389 +0x2c5                                                                                                                                                      
github.com/hashicorp/vault/vault.(*Core).Initialize(0x88f4a000, {0x7f69980, 0x88118010}, 0x8905d498)                                                                                                                 
        /home/runner/work/vault/vault/vault/init.go:248 +0x805

https://github.com/hashicorp/raft-boltdb/blob/2a80828627023c0835e68f992ea082a26508037b/v2/bolt_store.go#L271-L272

tx.Bucket(dbConf) can return nil and then we get this segfault. I know, that this normally does not happen, because the dbConf bucket should/must exist. But somehow I encountered this is my setup. Just wanted to let you know.

haraldh commented 1 year ago

closing this, as the code is fine from the logical execution