This repository has been archived by the owner on Mar 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
page already freed #731
Comments
Same here:
I insert 40Gib bytes to new db file, average slice len=30 bytes,max=30000: func Add(c chan []byte, bfile string) {
const bname = `bc41`
db, err := bolt.Open(bfile, 0600, nil)
if err != nil {
log.Fatal(err)
}
defer db.Close()
err = db.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists([]byte(bname))
if err != nil {
return err //fmt.Errorf("create bucket: %s", err)
}
return nil
})
if err != nil {
log.Fatal(err)
panic(err)
}
for {
err := db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(bname))
for i := 0; i < 100000; i++ {
v := <-c
if v == nil {
return nil
}
err = b.Put(v, []byte("0"))
if err != nil {
return err
}
}
return nil
})
if err != nil {
log.Fatal(err)
panic(err)
}
}
} |
reproducer, crash when file is 28 MiB: package main
import (
"log"
"math/rand"
// "github.com/coreos/bbolt"
"github.com/boltdb/bolt"
)
var BC = make(chan []byte)
func main() {
go Add(BC, "/opt/test.db")
s := make([]byte, 30)
for i := 0; i < 100000000; i++ {
rand.Read(s)
BC <- s
}
close(BC)
}
func Add(c chan []byte, bfile string) {
const bname = `bc41`
db, err := bolt.Open(bfile, 0600, nil)
if err != nil {
log.Fatal(err)
}
defer db.Close()
err = db.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists([]byte(bname))
if err != nil {
return err //fmt.Errorf("create bucket: %s", err)
}
return nil
})
if err != nil {
log.Fatal(err)
panic(err)
}
for {
err := db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(bname))
for i := 0; i < 100000; i++ {
v := <-c
if v == nil {
return nil
}
err = b.Put(v, []byte("0"))
if err != nil {
return err
}
}
return nil
})
if err != nil {
log.Fatal(err)
panic(err)
}
}
}
|
|
Opened issue in coreos/bbolt: |
There is race in my example, modified example without race works fine. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
curent version git i can upload db
Description: Ubuntu 16.04.3 LTS
The text was updated successfully, but these errors were encountered: