Skip to content

Assertion failure when locking a mutex in a c thread (linux) #17485

Closed
@blastrock

Description

@blastrock

Hi,

I get an assertion failure when I try to lock a mutex from a thread created from C++ (I think it is reproducible with c). I made a minimal example here: https://github.com/blastrock/rustcrash

Uncompress the archive and type "make run". On my machine it finishes with:

fatal runtime error:  assertion failed: !ptr.is_null()
Illegal instruction 

EDIT: Here is the stack trace:

(gdb) bt
#0  0x00005555555c39c5 in util::abort::hf673a6fea37897c4eEa ()
#1  0x00005555555bff79 in local_ptr::compiled::take::h12674065722481156391 ()
#2  0x00005555555c3006 in lock::failing::h8c52553afcb2a61cC7e ()
#3  0x00005555555c326a in lock::PoisonOnFail$LT$$x27a$GT$::new::hcfbb39080c770903y9e ()
#4  0x000055555555c37e in lock::Mutex$LT$T$GT$::lock::h9394655342227765001 ()
#5  0x000055555555c21b in callback::__rust_abi ()
#6  0x000055555555c1a3 in callback::h9d49d629a3b51de4faa ()
#7  0x00007ffff7bd8238 in trigger_callback () from ./liblib.so
#8  0x00007ffff7bd9699 in void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) () from ./liblib.so
#9  0x00007ffff7bd95e1 in std::_Bind_simple<void (*())()>::operator()() () from ./liblib.so
#10 0x00007ffff7bd955e in std::thread::_Impl<std::_Bind_simple<void (*())()> >::_M_run() () from ./liblib.so
#11 0x00007ffff6c9b8a0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007ffff77b70a4 in start_thread (arg=0x7ffff5fff700) at pthread_create.c:309
#13 0x00007ffff72d6c2d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions