Skip to content

Double free corruption with transactions in latest heed3 #355

@rracariu

Description

@rracariu

I discovered an issue with heed3 v0.22.0 and latest from master where in a stress scenario I get a double free corruption error in my application:

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x0000765c7a24527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000765c7a2288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000765c7a2297b6 in __libc_message_impl (fmt=fmt@entry=0x765c7a3ce8d7 "%s\n")
    at ../sysdeps/posix/libc_fatal.c:134
#6  0x0000765c7a2a8ff5 in malloc_printerr (str=str@entry=0x765c7a3d1aa0 "double free or corruption (top)")
    at ./malloc/malloc.c:5772
#7  0x0000765c7a2ab0fc in _int_free_merge_chunk (av=<optimized out>, p=<optimized out>, size=<optimized out>)
    at ./malloc/malloc.c:4671
#8  0x0000765c7a2ab43a in _int_free (av=0x765c7a403ac0 <main_arena>, p=<optimized out>, have_lock=<optimized out>)
    at ./malloc/malloc.c:4646
#9  0x0000765c7a2addae in __GI___libc_free (mem=0x64b790b30320) at ./malloc/malloc.c:3398
#10 0x0000765bf61d0d53 in mdb_midl_free (ids=0x64b790b30328)
    at /test/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lmdb-master3-sys-0.2.5/lmdb/libraries/liblmdb/midl.c:117
#11 0x0000765bf61ba9b1 in mdb_txn_end (txn=0x64b78daf3670, mode=0)
    at /test/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lmdb-master3-sys-0.2.5/lmdb/libraries/liblmdb/mdb.c:3677
#12 0x0000765bf61bd129 in _mdb_txn_commit (txn=0x64b78daf3670)
    at /test/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lmdb-master3-sys-0.2.5/lmdb/libraries/liblmdb/mdb.c:4497
#13 0x0000765bf61bd18d in mdb_txn_commit (txn=0x64b78daf3670)
    at /test/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lmdb-master3-sys-0.2.5/lmdb/libraries/liblmdb/mdb.c:4509
#14 0x0000765bf61b69a7 in heed3::txn::RwTxn::commit (self=...) at src/txn.rs:327

The code that triggers this looks like:

heed_db.put_with_flags(
                txn,
                PutFlags::NO_OVERWRITE,
                &some_key_bytes,
                &[],
            )

The env is configured to run with TLS on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions