bmatsuo / lmdb-go

Bindings for the LMDB C library
BSD 3-Clause "New" or "Revised" License
159 stars 58 forks source link

Assertion 'rc == 0' failed in mdb_page_dirty() #131

Open kevburnsjr opened 4 years ago

kevburnsjr commented 4 years ago

There is a bug in this version of mdb_cur_del that is causing my program to crash when using cursor delete with the dupsort flag. This bug has been fixed in the upstream lmdb repo.

https://www.openldap.org/lists/openldap-bugs/201707/msg00033.html https://github.com/LMDB/lmdb/commit/47ca2f7095f2aa6e395b7a5cfec46bce35a5d623

Upgrading mdb.c/mdb.h fixes this issue.

@bmatsuo Will you be around to merge a PR?

0mdb.c:2121: Assertion 'rc == 0' failed in mdb_page_dirty()
SIGABRT: abort
PC=0x7f1af247d5f7 m=168 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 37 [syscall, locked to thread]:
runtime.cgocall(0x8cae30, 0xc000051988, 0xc000000002)
        /usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000051958 sp=0xc000051920 pc=0x40c24b
github.com/bmatsuo/lmdb-go/lmdb._Cfunc_lmdbgo_mdb_cursor_put2(0x5f1a8c00c770, 0xc0003f7570, 0x4, 0xc0003f7574, 0x8, 0xc000000020, 0xc000000000)
        _cgo_gotypes.go:270 +0x4d fp=0xc000051988 sp=0xc000051958 pc=0x781d3d
github.com/bmatsuo/lmdb-go/lmdb.(*Cursor).Put.func1(0xc000bd6db0, 0xc0003f7570, 0x4, 0xc, 0xc0003f7574, 0x8, 0x8, 0x20, 0x43724a)
        /usr/local/share/go/pkg/mod/github.com/bmatsuo/lmdb-go@v1.8.0/lmdb/cursor.go:243 +0xb3 fp=0xc0000519d8 sp=0xc000051988 pc=0x78baa3
github.com/bmatsuo/lmdb-go/lmdb.(*Cursor).Put(0xc000bd6db0, 0xc0003f7570, 0x4, 0xc, 0xc0003f7574, 0x8, 0x8, 0x20, 0xc000051ab0, 0x783b3d)
        /usr/local/share/go/pkg/mod/github.com/bmatsuo/lmdb-go@v1.8.0/lmdb/cursor.go:243 +0x96 fp=0xc000051a40 sp=0xc0000519d8 pc=0x785016
main.writeBatch.func2(0xc0004226c0, 0x0, 0x0)
        /root/home/junk/badger-bench/populate/main.go:312 +0x183 fp=0xc000051b58 sp=0xc000051a40 pc=0x8c8683
github.com/bmatsuo/lmdb-go/lmdb.(*Env).run(0xc0000101d8, 0xc0007a1301, 0x0, 0xc000051ec0, 0x0, 0x0)
        /usr/local/share/go/pkg/mod/github.com/bmatsuo/lmdb-go@v1.8.0/lmdb/env.go:494 +0xe3 fp=0xc000051c10 sp=0xc000051b58 pc=0x788663
github.com/bmatsuo/lmdb-go/lmdb.(*Env).Update(...)
        /usr/local/share/go/pkg/mod/github.com/bmatsuo/lmdb-go@v1.8.0/lmdb/env.go:459
main.writeBatch(0xc00044ae00, 0x64, 0x64, 0x19f, 0xa, 0x0)
        /root/home/junk/badger-bench/populate/main.go:304 +0xb30 fp=0xc000051f38 sp=0xc000051c10 pc=0x8c4440
main.main.func7(0x41cdcd6500000000, 0x100, 0xc0003f6250, 0xc0000e20c0, 0xc0003f6260, 0xa)
        /root/home/junk/badger-bench/populate/main.go:695 +0x21a fp=0xc000051fb0 sp=0xc000051f38 pc=0x8c9f0a
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000051fb8 sp=0xc000051fb0 pc=0x467d51
created by main.main
        /root/home/junk/badger-bench/populate/main.go:680 +0xab4