Skip to content
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

Add support to use IMDB as reference #31

Closed
wants to merge 1 commit into from
Closed

Conversation

gergnz
Copy link
Contributor

@gergnz gergnz commented Jan 8, 2013

As tmpd3.py seems to support the output more metadata than tmdb.py but mythweb/video still uses imdb as key, I added support to tmdb3.py to lookup movies using IMDB id instead of only the the movie database reference.

@gergnz
Copy link
Contributor Author

gergnz commented Jan 11, 2013

@ex-nerd
Copy link
Member

ex-nerd commented Jan 12, 2013

This will be fixed with a different commit.

@ex-nerd ex-nerd closed this Jan 12, 2013
Beirdo pushed a commit that referenced this pull request Jan 30, 2014
ijc added a commit to ijc/mythtv that referenced this pull request Sep 28, 2019
The thread running HLSReader::Cancel calls HLSPlaylistWorker::Cancel with the
stream lock held, which blocks waiting for the thread to exit.

The HLSPlaylistWorker::run thread however can be at the point between the
m_cancel check and the call to HLSReader::PlaylistRetrying. Since
PlaylistRetrying also takes the stream lock we are therefore deadlocked.

See stack traces below.

To address this introduce a separate worker lock covering the m_playlistworker
and m_streamworker fields. This means that HLSReader::Cancel only needs to take
this new lock and therefore cannot deadlock against the use of the stream lock
in HLSReader::PlaylistRetrying.

When they need to be held together the new lock is consistently nested within
the old.

Strack traces:

        Thread 1571 (Thread 0x7ffefa7fc700 (LWP 13196)):
        #0  futex_wait_cancelable (private=0, expected=0, futex_word=0x7fff08101380) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        MythTV#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fff08101330, cond=0x7fff08101358) at pthread_cond_wait.c:502
        MythTV#2  __pthread_cond_wait (cond=0x7fff08101358, mutex=0x7fff08101330) at pthread_cond_wait.c:655
        MythTV#3  0x00007ffff10d01bb in QWaitCondition::wait(QMutex*, unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#4  0x00007ffff10cf66e in QThread::wait(unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#5  0x00007ffff55a3255 in MThread::wait (this=0x7fff0806fc60, time=18446744073709551615) at mthread.cpp:315
        MythTV#6  0x00007ffff619c476 in HLSPlaylistWorker::Cancel (this=0x7fff0806fc60) at recorders/HLS/HLSPlaylistWorker.cpp:30

            QMutexLocker lock(&m_stream_lock);

        MythTV#7  0x00007ffff61a1b82 in HLSReader::Cancel (this=0x7fffc8023ac0, quiet=false) at recorders/HLS/HLSReader.cpp:184
        MythTV#8  0x00007ffff61a11d5 in HLSReader::Close (this=0x7fffc8023ac0, quiet=false) at recorders/HLS/HLSReader.cpp:150
        MythTV#9  0x00007ffff619edf6 in HLSReader::~HLSReader (this=0x7fff200bbd80, __in_chrg=<optimized out>) at recorders/HLS/HLSReader.cpp:42
        <...>
        MythTV#31 0x00007ffff6196a63 in HLSStreamHandler::~HLSStreamHandler (this=0x7ffedc040e60, __in_chrg=<optimized out>) at recorders/hlsstreamhandler.cpp:113
        MythTV#32 0x0000000000000000 in ?? ()

        Thread 1566 (Thread 0x7ffefb7fe700 (LWP 13191)):
        #0  futex_reltimed_wait_cancelable (private=0, reltime=0x7ffefb7fd920, expected=0, futex_word=0x7fff08029d90) at ../sysdeps/unix/sysv/linux/futex-internal.h:142
        MythTV#1  __pthread_cond_wait_common (abstime=0x7ffefb7fd9e0, mutex=0x7fff08029d40, cond=0x7fff08029d68) at pthread_cond_wait.c:533
        MythTV#2  __pthread_cond_timedwait (cond=0x7fff08029d68, mutex=0x7fff08029d40, abstime=0x7ffefb7fd9e0) at pthread_cond_wait.c:667
        MythTV#3  0x00007ffff10d009c in QWaitCondition::wait(QMutex*, unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#4  0x00007ffff61b7321 in HLSStreamWorker::run (this=0x7ffedc018370) at recorders/HLS/HLSStreamWorker.cpp:91
        MythTV#5  0x00007ffff55a3c1c in MThreadInternal::run (this=0x7fff0803dab0) at mthread.cpp:79
        MythTV#6  0x00007ffff10cfa07 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#7  0x00007ffff0ff3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
        MythTV#8  0x00007ffff0bad4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

        Thread 1565 (Thread 0x7fff16ffd700 (LWP 13190)):
        #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
        MythTV#1  0x00007ffff10c2995 in QBasicMutex::lockInternal() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#2  0x00007ffff5a49bb0 in QMutexLocker::QMutexLocker (this=0x7fff16ffcc80, m=0x7ffee401fd00) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:206
        <...>

            QMutexLocker lock(&m_stream_lock);

        MythTV#6  0x00007ffff61b055e in HLSReader::PlaylistRetrying (this=0x7fffc8023b20) at recorders/HLS/HLSReader.cpp:1025
        <...>
        MythTV#12 0x00007ffff619d791 in HLSPlaylistWorker::run (this=0x7fff0806fc60) at recorders/HLS/HLSPlaylistWorker.cpp:83
        MythTV#13 0x00007ffff55a3c1c in MThreadInternal::run (this=0x7fff081082a0) at mthread.cpp:79
        MythTV#14 0x00007ffff10cfa07 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#15 0x00007ffff0ff3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
        MythTV#16 0x00007ffff0bad4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
ijc added a commit to ijc/mythtv that referenced this pull request Sep 28, 2019
The thread running HLSReader::Cancel calls HLSPlaylistWorker::Cancel with the
stream lock held, which blocks waiting for the thread to exit.

The HLSPlaylistWorker::run thread however can be at the point between the
m_cancel check and the call to HLSReader::PlaylistRetrying. Since
PlaylistRetrying also takes the stream lock we are therefore deadlocked.

See stack traces below.

To address this introduce a separate worker lock covering the m_playlistworker
and m_streamworker fields. This means that HLSReader::Cancel only needs to take
this new lock and therefore cannot deadlock against the use of the stream lock
in HLSReader::PlaylistRetrying.

When they need to be held together the new lock is consistently nested within
the old.

Strack traces:

        Thread 1571 (Thread 0x7ffefa7fc700 (LWP 13196)):
        #0  futex_wait_cancelable (private=0, expected=0, futex_word=0x7fff08101380) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        MythTV#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fff08101330, cond=0x7fff08101358) at pthread_cond_wait.c:502
        MythTV#2  __pthread_cond_wait (cond=0x7fff08101358, mutex=0x7fff08101330) at pthread_cond_wait.c:655
        MythTV#3  0x00007ffff10d01bb in QWaitCondition::wait(QMutex*, unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#4  0x00007ffff10cf66e in QThread::wait(unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#5  0x00007ffff55a3255 in MThread::wait (this=0x7fff0806fc60, time=18446744073709551615) at mthread.cpp:315
        MythTV#6  0x00007ffff619c476 in HLSPlaylistWorker::Cancel (this=0x7fff0806fc60) at recorders/HLS/HLSPlaylistWorker.cpp:30

            QMutexLocker lock(&m_stream_lock);

        MythTV#7  0x00007ffff61a1b82 in HLSReader::Cancel (this=0x7fffc8023ac0, quiet=false) at recorders/HLS/HLSReader.cpp:184
        MythTV#8  0x00007ffff61a11d5 in HLSReader::Close (this=0x7fffc8023ac0, quiet=false) at recorders/HLS/HLSReader.cpp:150
        MythTV#9  0x00007ffff619edf6 in HLSReader::~HLSReader (this=0x7fff200bbd80, __in_chrg=<optimized out>) at recorders/HLS/HLSReader.cpp:42
        <...>
        MythTV#31 0x00007ffff6196a63 in HLSStreamHandler::~HLSStreamHandler (this=0x7ffedc040e60, __in_chrg=<optimized out>) at recorders/hlsstreamhandler.cpp:113
        MythTV#32 0x0000000000000000 in ?? ()

        Thread 1566 (Thread 0x7ffefb7fe700 (LWP 13191)):
        #0  futex_reltimed_wait_cancelable (private=0, reltime=0x7ffefb7fd920, expected=0, futex_word=0x7fff08029d90) at ../sysdeps/unix/sysv/linux/futex-internal.h:142
        MythTV#1  __pthread_cond_wait_common (abstime=0x7ffefb7fd9e0, mutex=0x7fff08029d40, cond=0x7fff08029d68) at pthread_cond_wait.c:533
        MythTV#2  __pthread_cond_timedwait (cond=0x7fff08029d68, mutex=0x7fff08029d40, abstime=0x7ffefb7fd9e0) at pthread_cond_wait.c:667
        MythTV#3  0x00007ffff10d009c in QWaitCondition::wait(QMutex*, unsigned long) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#4  0x00007ffff61b7321 in HLSStreamWorker::run (this=0x7ffedc018370) at recorders/HLS/HLSStreamWorker.cpp:91
        MythTV#5  0x00007ffff55a3c1c in MThreadInternal::run (this=0x7fff0803dab0) at mthread.cpp:79
        MythTV#6  0x00007ffff10cfa07 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#7  0x00007ffff0ff3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
        MythTV#8  0x00007ffff0bad4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

        Thread 1565 (Thread 0x7fff16ffd700 (LWP 13190)):
        #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
        MythTV#1  0x00007ffff10c2995 in QBasicMutex::lockInternal() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#2  0x00007ffff5a49bb0 in QMutexLocker::QMutexLocker (this=0x7fff16ffcc80, m=0x7ffee401fd00) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:206
        <...>

            QMutexLocker lock(&m_stream_lock);

        MythTV#6  0x00007ffff61b055e in HLSReader::PlaylistRetrying (this=0x7fffc8023b20) at recorders/HLS/HLSReader.cpp:1025
        <...>
        MythTV#12 0x00007ffff619d791 in HLSPlaylistWorker::run (this=0x7fff0806fc60) at recorders/HLS/HLSPlaylistWorker.cpp:83
        MythTV#13 0x00007ffff55a3c1c in MThreadInternal::run (this=0x7fff081082a0) at mthread.cpp:79
        MythTV#14 0x00007ffff10cfa07 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
        MythTV#15 0x00007ffff0ff3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
        MythTV#16 0x00007ffff0bad4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants