On 15/12/20(Tue) 16:30, Mark Kettenis wrote: > > Date: Tue, 15 Dec 2020 12:15:30 -0300 > > From: Martin Pieuchot <m...@openbsd.org> > > > > When the first thread of multimedia/mpv exits after having played a video > > with the "gpu" (default) output, the programs receives a SIGSEV when it > > tries to execute one of its destructor: > > > > void > > _rthread_tls_destructors(pthread_t thread) > > { > > [...] > > for (i = 0; i < PTHREAD_DESTRUCTOR_ITERATIONS; i++) { > > for (rs = thread->local_storage; rs; rs = rs->next) { > > if (!rs->data) > > continue; > > if (rkeys[rs->keyid].destructor) { > > void (*destructor)(void *) = > > rkeys[rs->keyid].destructor; > > void *data = rs->data; > > rs->data = NULL; > > _spinunlock(&rkeyslock); > > destructor(data); <-- HERE > > _spinlock(&rkeyslock); > > } > > } > > } > > [...] > > } > > > > This doesn't happen with other outputs and I haven't checked/don't know > > which piece of code in the "gpu" output calls pthread_key_create(). > > > > Full backtrace below. > > > > $ mpv *.mp4 > > (+) Video --vid=1 (*) (h264 640x352 30.288fps) > > (+) Audio --aid=1 (*) (aac 2ch 48000Hz) > > libEGL warning: DRI3: Screen seems not DRI3 capable > > AO: [sdl] 48000Hz stereo 2ch s32 > > > > VO: [gpu] 640x352 yuv420p > > > > AV: 00:01:38 / 00:01:38 (100%) A-V: 0.000 > > > > > > > > > > Exiting... (End of file) > > > > pthread_mutex_destroy on mutex with waiters! > > > Segmentation fault (core dumped) > > POSIX says: > > "Attempting to destroy a locked mutex, or a mutex that another > thread is attempting to lock, or a mutex that is being used in a > pthread_cond_timedwait() or pthread_cond_wait() call by another > thread, results in undefined behavior."
It is not clear if this is related. If it is, we don't know what changed to make it happen. Also why this SIGSEV doesn't happen with other outputs, or when playing music, even if the pthread_mutex_destroy message is printed?