Deadlock - library scan vs track playback (Win)

Bug #1445320 reported by kramer on 2015-04-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

(Note: I was testing the master branch when I meant to be testing NewSoundSourceAPI. I will try to reproduce on the desired branch.)

Similar to #1445298, this affects M4A/AAC. I was playing an AAC file, then clicked "Rescan Library", then tried to load another AAC file. This apparently caused a deadlock. I verified that both threads were blocked on the same file in the debugger. The trace of the library scanner thread:

  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> soundsourcemediafoundation.dll!SoundSourceMediaFoundation::read(unsigned long size, const short * destination) Line 225 + 0x26 bytes C++
  mixxx.exe!AnalyserQueue::doAnalysis(QSharedPointer<TrackInfoObject> tio, const QSharedPointer<Mixxx::SoundSource> & pSoundSource) Line 177 + 0x24 bytes C++
  mixxx.exe!AnalyserQueue::run() Line 332 + 0x1a bytes C++
  QtCored4.dll!QThreadPrivate::start(void * arg) Line 357 C++

The trace of the other thread (same as #1445298):

  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> soundsourcemediafoundation.dll!SoundSourceMediaFoundation::seek(long filepos) Line 167 + 0x1d bytes C++
  mixxx.exe!CachingReaderWorker::processChunkReadRequest(ChunkReadRequest * request, ReaderStatusUpdate * update) Line 71 C++
  mixxx.exe!CachingReaderWorker::run() Line 115 C++
  QtCored4.dll!QThreadPrivate::start(void * arg) Line 357 C++

Daniel Schürmann (daschuer) wrote :

Buh! It looks like SoundSourceMediaFoundation/mfreadwrite.dll is not thread save.

Maybe it is caused by

Here is is recommendation to use COINIT_MULTITHREADED

However in other place you found advises that you have to use COINIT_APARTMENTTHREADED

Even if setting COINIT_MULTITHREADED fixes the issue,
It will likely enable an extra locking layer. That may cause a priority inversion between th low priority analyzer thread and the High priority caching worker thread.

The issue seams to be difficult. Maybe it helps switching to the Callback interface.
But that is not a short term solution.

Changed in mixxx:
importance: Undecided → Critical
milestone: none → 1.12.0
Daniel Schürmann (daschuer) wrote :

Thank you for looking at this!
I'm am curious to to hear how COINIT_MULTITHREADED makes a difference.

Is Bug #1445298 a duplicate?

kramer (default-kramer) wrote :

They are certainly related, but may not be an exact duplicate. The difference is in Bug 1445298, none of the other threads in Mixxx were touching the AAC file - they all looked "normal" (e.g. in a QT or OS wait). In this bug, it was clear that two Mixxx threads were deadlocked on the same AAC file.

summary: - Deadlock - library scan vs track playback
+ Deadlock - library scan vs track playback (Win)
tags: added: library windows
tags: removed: library
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers