-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Panic: Duplicate mutex destroy on Thread.join (DragonFly) #20698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you get a backtrace at what's failing as well? I would be quite surprised if we destroyed a mutex twice, because that's certainly very bad! Can you also make sure that this passes successfully for you? #include <assert.h>
#include <pthread.h>
int main() {
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
assert(pthread_mutex_destroy(&lock) == 0);
} |
It fails with error code 22, if I compile it like The backtrace of the example program I gave above is:
|
Interestingly, it does not fail once it goes through a lock/unlock cycle prior of destruction: #include <pthread.h>
#include <stdio.h>
int main() {
int err = 0;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
err = pthread_mutex_lock(&mutex);
printf("lock: %d\n", err);
err = pthread_mutex_unlock(&mutex);
printf("unlock: %d\n", err);
err = pthread_mutex_destroy(&mutex);
printf("destroy1: %d\n", err);
err = pthread_mutex_destroy(&mutex);
printf("destroy2: %d\n", err);
return 0;
} returns:
And also, if I call |
Fix assertion in Mutex::destroy() on DragonFly (#20698) Reviewed-by: alexcrichton
I believe this was mitigated in #20741 |
Yes! #20741 fixed it! |
The following program triggers this:
When compiled on DragonFly with most recent rust (and all versions since the removal of rustrt), it fails with:
The code that fails is:
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.
The text was updated successfully, but these errors were encountered: