Panic on bash for windows
Running the same tests on a Linux box works, but running on Bash for Windows, I'm getting this panic:
=== RUN TestBolt
unexpected fault address 0x7f954ba94008
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x7f954ba94008 pc=0x578e39]
goroutine 35 [running]:
runtime.throw(0x882155, 0x5)
/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc4202910b8 sp=0xc420291098
runtime.sigpanic()
/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x288 fp=0xc420291110 sp=0xc4202910b8
github.com/iron-io/functions/vendor/github.com/boltdb/bolt.(*Cursor).search(0xc4202912c0, 0xc420010548, 0x4, 0x8, 0x4)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/vendor/github.com/boltdb/bolt/cursor.go:255 +0x69 fp=0xc4202911
d8 sp=0xc420291110
github.com/iron-io/functions/vendor/github.com/boltdb/bolt.(*Cursor).seek(0xc4202912c0, 0xc420010548, 0x4, 0x8, 0x0, 0x0, 0xc4
20011500, 0x2, 0x2, 0x2, ...)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/vendor/github.com/boltdb/bolt/cursor.go:159 +0xb1 fp=0xc4202912
28 sp=0xc4202911d8
github.com/iron-io/functions/vendor/github.com/boltdb/bolt.(*Bucket).Bucket(0xc4203380f8, 0xc420010548, 0x4, 0x8, 0xc420054080
)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/vendor/github.com/boltdb/bolt/bucket.go:112 +0x108 fp=0xc420291
2f0 sp=0xc420291228
github.com/iron-io/functions/vendor/github.com/boltdb/bolt.(*Tx).Bucket(0xc4203380e0, 0xc420010548, 0x4, 0x8, 0x42a4e3)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/vendor/github.com/boltdb/bolt/tx.go:101 +0x4f fp=0xc420291328 s
p=0xc4202912f0
github.com/iron-io/functions/api/datastore/bolt.(*BoltDatastore).InsertApp.func1(0xc4203380e0, 0x8c1680, 0xc4203380e0)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/api/datastore/bolt/bolt.go:92 +0x70 fp=0xc4202913b0 sp=0xc42029
1328
github.com/iron-io/functions/vendor/github.com/boltdb/bolt.(*DB).Update(0xc420120000, 0xc420291430, 0x0, 0x0)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/vendor/github.com/boltdb/bolt/db.go:595 +0xb5 fp=0xc420291400 s
p=0xc4202913b0
github.com/iron-io/functions/api/datastore/bolt.(*BoltDatastore).InsertApp(0xc4204e4100, 0xa846c0, 0xc4200105d0, 0xaaa3e0, 0x1
, 0xa7f140, 0xc420307d70)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/api/datastore/bolt/bolt.go:114 +0xd4 fp=0xc420291470 sp=0xc4202
91400
github.com/iron-io/functions/api/datastore.TestBolt(0xc4202ba240)
/mnt/c/Users/proph/go/src/github.com/iron-io/functions/api/datastore/bolt_test.go:37 +0x5de fp=0xc420291f58 sp=0xc4202
91470
testing.tRunner(0xc4202ba240, 0x8c1410)
/usr/local/go/src/testing/testing.go:610 +0x81 fp=0xc420291f80 sp=0xc420291f58
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420291f88 sp=0xc420291f80
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:646 +0x2ec
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4202ba180, 0x884eee, 0x8, 0x8c1410, 0xab65c0)
/usr/local/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc4202ba180)
/usr/local/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc4202ba180, 0xc420295e10)
/usr/local/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x8c1e38, 0xaaa520, 0x2, 0x2, 0x411356)
/usr/local/go/src/testing/testing.go:799 +0x2f5
testing.(*M).Run(0xc420295ed8, 0x4113ed)
/usr/local/go/src/testing/testing.go:743 +0x85
main.main()
github.com/iron-io/functions/api/datastore/_test/_testmain.go:56 +0xc6
Does the bolt test suite run successfully on Bash for Windows?
Looks like it panics too:
seed: 71900
quick settings: count=5, items=1000, ksize=1024, vsize=1024
=== RUN TestFreelist_free
--- PASS: TestFreelist_free (0.00s)
=== RUN TestFreelist_free_overflow
--- PASS: TestFreelist_free_overflow (0.00s)
=== RUN TestFreelist_release
--- PASS: TestFreelist_release (0.00s)
=== RUN TestFreelist_allocate
--- PASS: TestFreelist_allocate (0.00s)
=== RUN TestFreelist_read
--- PASS: TestFreelist_read (0.00s)
=== RUN TestFreelist_write
--- PASS: TestFreelist_write (0.00s)
=== RUN TestNode_put
--- PASS: TestNode_put (0.00s)
=== RUN TestNode_read_LeafPage
--- PASS: TestNode_read_LeafPage (0.00s)
=== RUN TestNode_write_LeafPage
--- PASS: TestNode_write_LeafPage (0.00s)
=== RUN TestNode_split
--- PASS: TestNode_split (0.00s)
=== RUN TestNode_split_MinKeys
--- PASS: TestNode_split_MinKeys (0.00s)
=== RUN TestNode_split_SinglePage
--- PASS: TestNode_split_SinglePage (0.00s)
=== RUN TestPage_typ
--- PASS: TestPage_typ (0.00s)
=== RUN TestPage_dump
00010000000000000000000000000000
--- PASS: TestPage_dump (0.00s)
=== RUN TestPgids_merge
--- PASS: TestPgids_merge (0.00s)
=== RUN TestPgids_merge_quick
--- PASS: TestPgids_merge_quick (0.00s)
=== RUN TestBucket_Get_NonExistent
unexpected fault address 0x7fc03dfc500c
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x7fc03dfc500c pc=0x491c2e]
goroutine 34 [running]:
runtime.throw(0x5bb932, 0x5)
/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc4200204e8 sp=0xc4200204c8
runtime.sigpanic()
/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x288 fp=0xc420020540 sp=0xc4200204e8
github.com/boltdb/bolt.(*Tx).check(0xc4200acfc0, 0xc4200a5140)
github.com/boltdb/bolt/_test/_obj_test/tx.go:458 +0x53e fp=0xc4200207b0 sp=0xc420020540
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc4200207b8 sp=0xc4200207b0
created by github.com/boltdb/bolt.(*Tx).Check
github.com/boltdb/bolt/_test/_obj_test/tx.go:434 +0x71
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200a6000, 0x5c0fc3, 0x1a, 0x5d2fe8, 0xc420039c01)
/usr/local/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc4200a6000)
/usr/local/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc4200a6000, 0xc420039d88)
/usr/local/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x5d3440, 0x6931c0, 0x90, 0x90, 0xc42009c150)
/usr/local/go/src/testing/testing.go:799 +0x2f5
testing.(*M).Run(0xc420039ee8, 0x5c1ce3)
/usr/local/go/src/testing/testing.go:743 +0x85
main.main()
github.com/boltdb/bolt/_test/_testmain.go:444 +0x1bd
goroutine 33 [chan receive]:
github.com/boltdb/bolt_test.(*DB).MustCheck.func1(0xc4200acfc0, 0x5d2d18, 0xc4200acfc0)
/mnt/c/Users/proph/go/src/github.com/boltdb/bolt/db_test.go:1422 +0xad
github.com/boltdb/bolt.(*DB).Update(0xc4200f8b40, 0x5d2e00, 0x0, 0x0)
github.com/boltdb/bolt/_test/_obj_test/db.go:639 +0xdd
github.com/boltdb/bolt_test.(*DB).MustCheck(0xc4200ba030)
/mnt/c/Users/proph/go/src/github.com/boltdb/bolt/db_test.go:1450 +0x3e
github.com/boltdb/bolt_test.(*DB).Close(0xc4200ba030, 0x0, 0x0)
/mnt/c/Users/proph/go/src/github.com/boltdb/bolt/db_test.go:1388 +0x53
github.com/boltdb/bolt_test.(*DB).MustClose(0xc4200ba030)
/mnt/c/Users/proph/go/src/github.com/boltdb/bolt/db_test.go:1397 +0x2b
github.com/boltdb/bolt_test.TestBucket_Get_NonExistent(0xc4200a72c0)
/mnt/c/Users/proph/go/src/github.com/boltdb/bolt/bucket_test.go:36 +0xa6
testing.tRunner(0xc4200a72c0, 0x5d2fe8)
/usr/local/go/src/testing/testing.go:610 +0x81
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:646 +0x2ec
exit status 2
FAIL github.com/boltdb/bolt 0.083s
Makefile:15: recipe for target 'test' failed
make: *** [test] Error 1
@treeder Hmm, I'm not sure off the top of my head. From the test it looks like the test finishes but panics while doing a consistency check. I'll have to get a Windows image installed on my machine to test it out.
It's a bit of a process to setup as of now, but here's a guide: https://medium.com/travis-on-development/can-windows-replace-your-macbook-for-dev-yes-and-its-quite-nice-a365eb17c9a5#.ldb8k1iez
I have encountered the same problem. On windows bolt panics.
package main
import (
"fmt"
"log"
"github.com/boltdb/bolt"
)
func main() {
fmt.Println("Hello")
db, err := bolt.Open("my.db", 0600, nil)
if err != nil {
log.Fatal(err)
}
db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("MyBucket"))
err := b.Put([]byte("answer"), []byte("42"))
return err
})
db.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("MyBucket"))
v := b.Get([]byte("answer"))
fmt.Printf("The answer is: %s\n", v)
return nil
})
defer db.Close()
}
Output log:
Hello
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x463b6e]
goroutine 1 [running]:
panic(0x4d0180, 0xc04200e080)
C:/Go/src/runtime/panic.go:500 +0x1af
github.com/boltdb/bolt.(*Bucket).Put(0x0, 0xc042038440, 0x6, 0x8, 0xc042038448, 0x2, 0x8, 0xc04202fe28, 0x4691ed)
D:/Workspace/golang/src/github.com/boltdb/bolt/bucket.go:286 +0x3e
main.main.func1(0xc04207c000, 0x4f99b0, 0xc04207c000)
D:/Workspace/golang/src/fileDb/main.go:20 +0x144
github.com/boltdb/bolt.(*DB).Update(0xc042076000, 0x4f99d0, 0x0, 0x0)
D:/Workspace/golang/src/github.com/boltdb/bolt/db.go:598 +0xbc
main.main()
D:/Workspace/golang/src/fileDb/main.go:22 +0x106
The latest insider preview fast-track builds seem to have fixed it. Bolt works fine for me on build 15019.
@egtann I tried using Storm and it worked. But when I tried to use example that I pasted above still doesn't work (panics).
Can you give me example that you were testing?
It might be a regression on the Windows side but on insider build 15031 the boltdb tests are failing again. Does it make sense to bump this issue up to the Bash on Windows people?
esell@MININT-CI19LTV:~/go/src/github.com/boltdb/bolt on master
$ go test .
seed: 45200
quick settings: count=5, items=1000, ksize=1024, vsize=1024
00010000000000000000000000000000
unexpected fault address 0x7f3d011a500c
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7f3d011a500c pc=0x48e8f2]
goroutine 22 [running]:
runtime.throw(0x5b5def, 0x5)
/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc420025ce8 sp=0xc420025cc8
runtime.sigpanic()
/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x288 fp=0xc420025d40 sp=0xc420025ce8
github.com/boltdb/bolt.(*Tx).check(0xc420084fc0, 0xc42005b200)
/home/esell/go/src/github.com/boltdb/bolt/tx.go:397 +0x4b2 fp=0xc420025fb0 sp=0xc420025d40
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420025fb8 sp=0xc420025fb0
created by github.com/boltdb/bolt.(*Tx).Check
/home/esell/go/src/github.com/boltdb/bolt/tx.go:377 +0x67
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200780c0, 0x5bb480, 0x1a, 0x5cd2c8, 0xc42003bd01)
/usr/local/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc4200780c0)
/usr/local/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc4200780c0, 0xc42003be20)
/usr/local/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x5cd720, 0x687e60, 0x90, 0x90, 0x0)
/usr/local/go/src/testing/testing.go:799 +0x2f5
testing.(*M).Run(0xc42003bee8, 0x57f040)
/usr/local/go/src/testing/testing.go:743 +0x85
main.main()
github.com/boltdb/bolt/_test/_testmain.go:376 +0xc6
goroutine 21 [chan receive]:
github.com/boltdb/bolt_test.(*DB).MustCheck.func1(0xc420084fc0, 0x5ccff8, 0xc420084fc0)
/home/esell/go/src/github.com/boltdb/bolt/db_test.go:1422 +0xad
github.com/boltdb/bolt.(*DB).Update(0xc4200c0b40, 0x5cd0e0, 0x0, 0x0)
/home/esell/go/src/github.com/boltdb/bolt/db.go:598 +0xb5
github.com/boltdb/bolt_test.(*DB).MustCheck(0xc420028058)
/home/esell/go/src/github.com/boltdb/bolt/db_test.go:1450 +0x3e
github.com/boltdb/bolt_test.(*DB).Close(0xc420028058, 0x0, 0x0)
/home/esell/go/src/github.com/boltdb/bolt/db_test.go:1388 +0x53
github.com/boltdb/bolt_test.(*DB).MustClose(0xc420028058)
/home/esell/go/src/github.com/boltdb/bolt/db_test.go:1397 +0x2b
github.com/boltdb/bolt_test.TestBucket_Get_NonExistent(0xc420079380)
/home/esell/go/src/github.com/boltdb/bolt/bucket_test.go:36 +0xa6
testing.tRunner(0xc420079380, 0x5cd2c8)
/usr/local/go/src/testing/testing.go:610 +0x81
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:646 +0x2ec
FAIL github.com/boltdb/bolt 0.050s
Bump. Getting the same issue using bolt on windows :(