Skip to content

Panic: Duplicate mutex destroy on Thread.join (DragonFly) #20698

Closed
@mneumann

Description

@mneumann

The following program triggers this:

use std::thread::Thread;

fn main() {
    Thread::spawn(move || { println!("Hello"); }).join();
    println!("After join");
}

When compiled on DragonFly with most recent rust (and all versions since the removal of rustrt), it fails with:

hello
thread '<main>' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `22`, right: `0`)',
/home/..../rust/src/libstd/sys/unix/mutex.rs:53

The code that fails is:

let r = ffi::pthread_mutex_destory(self.inner.get());
debug_assert_eq!(r, 0);

It returns with error code 22 (EINVAL) instead of 0. To me it seems that Mutex::destroy() is called twice! It might be related to the new TLS thread_local code and destructor support, but it's pretty hard to understand, so any ideas how to track the bug further down and fix it is welcomed.

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