Bug 133120 - deadlock in VideoQueue::close on pthread_join
Summary: deadlock in VideoQueue::close on pthread_join
Status: RESOLVED INTENTIONAL
Alias: None
Product: Phonon
Classification: Frameworks and Libraries
Component: avKode backend (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Allan Sandfeld
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-28 12:53 UTC by Matthias Kretz
Modified: 2009-11-08 21:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Kretz 2006-08-28 12:53:27 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5) 
OS:                Linux

I ran mediaplayer in gdb playing a simple ogg vorbis file.

Here's what I got:

(gdb) thread 1
[Switching to thread 1 (Thread -1235555968 (LWP 19166))]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7e2fc76 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb7e744b2 in QWaitCondition::wait (this=0x81756a4, mutex=0x8175690, time=4294967295)
    at /home/mkretz/KDE/src/qt-copy/src/corelib/thread/qwaitcondition_unix.cpp:254
#3  0xb7e73cb6 in QThread::wait (this=0x8195650, time=4294967295) at /home/mkretz/KDE/src/qt-copy/src/corelib/thread/qthread_unix.cpp:449
#4  0xb6180eda in Phonon::Avkode::AbstractMediaProducer::stop (this=0x8175598) at /home/mkretz/KDE/src/kdemultimedia/avkode/backend/abstractmediaproducer.cpp:68
#5  0xb7bb76d4 in Phonon::AbstractMediaProducer::stop (this=0x8176740) at /home/mkretz/KDE/src/kdelibs/phonon/abstractmediaproducer.cpp:161
#6  0xb7bba61f in Phonon::MediaObject::stop (this=0x8176740) at /home/mkretz/KDE/src/kdelibs/phonon/mediaobject.cpp:116
#7  0xb7bbb66e in Phonon::MediaObject::qt_metacall (this=0x8176740, _c=QMetaObject::InvokeMetaMethod, _id=-11, _a=0xbf8a863c) at mediaobject.moc:91
#8  0xb7f2b379 in QMetaObject::activate (sender=0x81858a0, from_signal_index=29, to_signal_index=30, argv=0xbf8a863c)
    at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qobject.cpp:2904
#9  0xb7f2b4cc in QMetaObject::activate (sender=0x81858a0, m=0xb72b9dd0, from_local_signal_index=2, to_local_signal_index=3, argv=0xbf8a863c)
    at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qobject.cpp:2959
#10 0xb720f458 in QAbstractButton::clicked (this=0x81858a0, _t1=false) at .moc/debug-shared/moc_qabstractbutton.cpp:176
#11 0xb7028e3f in QAbstractButtonPrivate::emitClicked (this=0x817ea50) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qabstractbutton.cpp:488
#12 0xb7029053 in QAbstractButtonPrivate::click (this=0x817ea50) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qabstractbutton.cpp:481
#13 0xb70292c2 in QAbstractButton::mouseReleaseEvent (this=0x81858a0, e=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qabstractbutton.cpp:1038
#14 0xb70dda8e in QToolButton::mouseReleaseEvent (this=0x81858a0, e=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qtoolbutton.cpp:598
#15 0xb6d97fe4 in QWidget::event (this=0x81858a0, event=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qwidget.cpp:5530
#16 0xb7028ddb in QAbstractButton::event (this=0x81858a0, e=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qabstractbutton.cpp:1000
#17 0xb70ddde8 in QToolButton::event (this=0x81858a0, e=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/widgets/qtoolbutton.cpp:1003
#18 0xb6d4985d in QApplicationPrivate::notify_helper (this=0x804f108, receiver=0x81858a0, e=0xbf8a8e78)
    at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qapplication.cpp:3424
#19 0xb6d4a42e in QApplication::notify (this=0xbf8a9554, receiver=0x81858a0, e=0xbf8a8e78) at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qapplication.cpp:3123
#20 0xb7c989c0 in KApplication::notify (this=0xbf8a9554, receiver=0x81858a0, event=0xbf8a8e78) at /home/mkretz/KDE/src/kdelibs/kdecore/kapplication.cpp:344
#21 0xb6d52389 in QCoreApplication::sendSpontaneousEvent (receiver=0x81858a0, event=0xbf8a8e78) at qcoreapplication.h:183
#22 0xb6db202f in QETWidget::translateMouseEvent (this=0x81858a0, event=0xbf8a9260) at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qapplication_x11.cpp:3644
#23 0xb6dafe26 in QApplication::x11ProcessEvent (this=0xbf8a9554, event=0xbf8a9260) at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qapplication_x11.cpp:2753
#24 0xb6dd8143 in x11EventSourceDispatch (s=0x8054dd8, callback=0, user_data=0x0) at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:120
#25 0xb67958d6 in IA__g_main_context_dispatch (context=0x8053860) at gmain.c:1916
#26 0xb6798996 in g_main_context_iterate (context=0x8053860, block=1, dispatch=1, self=0x81a14d8) at gmain.c:2547
#27 0xb6798e1e in IA__g_main_context_iteration (context=0x8053860, may_block=1) at gmain.c:2606
#28 0xb7f42a70 in QEventDispatcherGlib::processEvents (this=0x8053538, flags=@0xbf8a9408)
    at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:349
#29 0xb6dd7bf0 in QGuiEventDispatcherGlib::processEvents (this=0x8053538, flags=@0xbf8a943c)
    at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:176
#30 0xb7f182d0 in QEventLoop::processEvents (this=0xbf8a94b0, flags=@0xbf8a9474) at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qeventloop.cpp:125
#31 0xb7f18534 in QEventLoop::exec (this=0xbf8a94b0, flags=@0xbf8a94b8) at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qeventloop.cpp:167
#32 0xb7f1cd57 in QCoreApplication::exec () at /home/mkretz/KDE/src/qt-copy/src/corelib/kernel/qcoreapplication.cpp:680
#33 0xb6d48d4e in QApplication::exec () at /home/mkretz/KDE/src/qt-copy/src/gui/kernel/qapplication.cpp:2917
#34 0x0804b855 in main (argc=-4, argv=0xfffffffc) at /home/mkretz/KDE/src/kdelibs/phonon/ui/tests/mediaplayer.cpp:98
(gdb) thread 2
[Switching to thread 2 (Thread -1251755088 (LWP 19172))]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7e2e21d in pthread_join () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6170684 in AvKode::VideoQueue::close (this=0xb4c0afcc) at /home/mkretz/KDE/src/kdemultimedia/avkode/avkode/videoqueue.cpp:112
#3  0xb617072d in ~VideoQueue (this=0xb4c0afcc) at /home/mkretz/KDE/src/kdemultimedia/avkode/avkode/videoqueue.cpp:100
#4  0xb6171a7b in ~Synchronizer (this=0xb4c00e68) at /home/mkretz/KDE/src/kdemultimedia/avkode/avkode/synchronizer.cpp:35
#5  0xb6181c08 in Phonon::Avkode::AbstractMediaProducer::AvkodeThread::run (this=0x8195650)
    at /home/mkretz/KDE/src/kdemultimedia/avkode/backend/abstractmediaproducer.cpp:196
#6  0xb7e733fa in QThreadPrivate::start (arg=0x8195650) at /home/mkretz/KDE/src/qt-copy/src/corelib/thread/qthread_unix.cpp:131
#7  0xb7e2d341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8  0xb68bf4ee in clone () from /lib/tls/i686/cmov/libc.so.6
(gdb) thread 3
[Switching to thread 3 (Thread -1262486608 (LWP 19174))]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7e2fc76 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb617056b in AvKode::handleFrame (d=0xb4c0c650) at thread.h:52
#3  0xb6170629 in AvKode::run (opaque=0xb4c0c650) at /home/mkretz/KDE/src/kdemultimedia/avkode/avkode/videoqueue.cpp:90
#4  0xb7e2d341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#5  0xb68bf4ee in clone () from /lib/tls/i686/cmov/libc.so.6

VideoQueue seems to be waiting for more data in thread 3, while thread 2 waits for thread 3. Thread 1 waits for thread 2 to finish.
Comment 1 Allan Sandfeld 2006-08-28 14:21:48 UTC
SVN commit 578101 by carewolf:

Remember to release any conditions.

BUG:133120


 M  +2 -0      videoqueue.cpp  


--- branches/work/avkode/avkode/videoqueue.cpp #578100:578101
@@ -55,6 +55,7 @@
 
         if (d->time_queue.empty())
             d->not_empty.wait(&d->mutex);
+        if (d->halt) return;
 
         assert(!d->time_queue.empty());
         assert(!d->frame_queue.empty());
@@ -109,6 +110,7 @@
 
 void VideoQueue::close() {
     d->halt = true;
+    d->not_empty.signal();
     pthread_join(d->video_thread, 0);
     d->sink = 0;
 
Comment 2 Allan Sandfeld 2006-08-28 16:31:28 UTC
Well, actually there is a problem more. I need be able to release IO-streams in any state.
Comment 3 Jonas Vejlin 2009-07-02 21:58:40 UTC
Is this still valid?
Comment 4 Jonathan Thomas 2009-11-08 15:10:04 UTC
Setting to WAITINGFORINFO for the previous comment.
Comment 5 Allan Sandfeld 2009-11-08 21:54:33 UTC
Closing avKode has never been released and is not maintained.