As I have mentioned here before, ogg123 from 1.0rc3 segfaults after playing a file on FreeBSD and OpenBSD. This happens with both the native pthread and with GNU pth. I have finally managed to isolate the problem. ogg123 crashes inside pthread_cond_wait(), specifically in the COND_WAIT() call in buffer_wait_for_empty(). *If* I understand the control flow correctly, the decoder thread waits on a condition variable here that has already been removed by the other thread winding down in buffer_thread_cleanup(). This would result in "undefined behavior". Removing the pthread_*_destroy() calls from buffer_thread_cleanup() eliminates the crash. --- ogg123/buffer.c.orig Thu Dec 20 01:24:53 2001 +++ ogg123/buffer.c Wed Jan 16 03:26:15 2002 @@ -88,9 +88,11 @@ /* Cleanup thread data structures */ pthread_mutex_unlock(&buf->mutex); +#if 0 /* KLUDGE: disabling this keeps ogg123 from crashing */ pthread_mutex_destroy(&buf->mutex); pthread_cond_destroy(&buf->playback_cond); pthread_cond_destroy(&buf->write_cond); +#endif } <p> -- Christian "naddy" Weisgerber naddy@mips.inka.de --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Segher Boessenkool
2002-Jan-19 05:55 UTC
[vorbis-dev] ogg123 1.0rc3 thread issue [FIXED] [#112]
Christian Weisgerber wrote:> > As I have mentioned here before, ogg123 from 1.0rc3 segfaults after > playing a file on FreeBSD and OpenBSD. This happens with both the > native pthread and with GNU pth. I have finally managed to isolate > the problem.Hi Christian, list, I checked a fix for this problem into xiph.org cvs. Only tested on OpenBSD/x86 (and regression tested on Linux/ppc), so you might want to test it on FreeBSD. On OpenBSD 3.0, we still get bitten by the bug in libc_r where signals arriving while a thread that doesn't handle them runs, don't get delivered to the thread that _does_ handle them, either. In short, update libc_r from cvs and be happy. Otherwise, you won't be able to pause (^Z), skip to next song (^C), or quit (^C^C). You can always stop ogg123 with a SIGQUIT (^\), of course. Btw, why do the BSD ports remove -O from the Makefiles? It's actually needed (for libvorbis, at least). Have fun, <p>Segher <p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.