crash enabling PFL after deleting EffectState while PFL is disabled

Bug #1741213 reported by Rudolf Gallander
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Critical
Be

Bug Description

I am having crashes after using the filter effect (affects both Filter and Moog Filter), which occur after having disabled the FX unit and having loaded another track. At first it seemed kind of sporadic to me, but I have been able to reproduce this crash about 6 times this morning.

Steps to reproduce:
* Have tracks playing on deck A and B
* Set FX Unit 1, Effect 1 to Moog Filter and activate it
* Set FX Unit 2, Effect 1 to Moog Filter and activate it
* Assign FX Unit 1 to deck A
* Assign FX Unit 2 to deck B
* Play around with the filter effects on both decks a little bit
* Un-Assign FX Unit 1 from deck A
* Un-Assign FX Unit 2 from deck B
* Stop Deck A and load new track
* Press Headphone Cue Button of deck A
--> Crash

If Moog Filter has been used I am getting the following exception:

 Exception #: 0XC0000005
 Stack:
  mixxx!EngineFilterMoogLadderBase<2>::setParameter+0xbc [c:\projects\mixxx\src\engine\enginefiltermoogladder4.h @ 103]
  mixxx!MoogLadder4FilterEffect::processChannel+0xcb [c:\projects\mixxx\src\effects\native\moogladder4filtereffect.cpp @ 133]
  mixxx!EngineEffect::process+0x124 [c:\projects\mixxx\src\engine\effects\engineeffect.cpp @ 203]
  mixxx!EngineEffectChain::process+0x170 [c:\projects\mixxx\src\engine\effects\engineeffectchain.cpp @ 254]
  mixxx!EngineEffectRack::process+0x1df [c:\projects\mixxx\src\engine\effects\engineeffectrack.cpp @ 79]
  mixxx!EngineEffectsManager::processInner+0x1db [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 222]
  mixxx!EngineEffectsManager::processPostFaderAndMix+0x67 [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 169]
  mixxx!ChannelMixer::applyEffectsAndMixChannels+0x185 [c:\projects\mixxx\src\engine\channelmixer_autogen.cpp @ 48]
  mixxx!EngineMaster::process+0x32d [c:\projects\mixxx\src\engine\enginemaster.cpp @ 428]
  mixxx!SoundDevicePortAudio::callbackProcessClkRef+0x57a [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 941]
  mixxx!`anonymous namespace'::paV19CallbackClkRef+0x27 [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 84]
  mixxx!AdaptingOutputOnlyProcess+0xd2 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1117]
  mixxx!PaUtil_EndBufferProcessing+0x209 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1643]
  mixxx!bufferSwitchTimeInfo+0x364 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\hostapi\asio\pa_asio.cpp @ 3137]
  rlasio64!DllUnregisterServer+0x3abc
  rlasio64!DllUnregisterServer+0x3e30
  rlasio64!DllUnregisterServer+0x3c00
  rlasio64!DllUnregisterServer+0x3af9
  KERNEL32!BaseThreadInitThunk+0x14
  ntdll!RtlUserThreadStart+0x21

If Filter has been used I am getting the following exception:

 Exception #: 0XC0000005
 Stack:
  ucrtbase!_stdio_common_vsnprintf_s+0x373
  ucrtbase!_stdio_common_vsprintf_s+0x31
  mixxx!sprintf_s+0x45 [c:\program files (x86)\windows kits\10\include\10.0.14393.0\ucrt\stdio.h @ 1838]
  mixxx!EngineFilterBiquad1Low::setFrequencyCorners+0x39 [c:\projects\mixxx\src\engine\enginefilterbiquad1.cpp @ 59]
  mixxx!FilterEffect::processChannel+0x177 [c:\projects\mixxx\src\effects\native\filtereffect.cpp @ 148]
  mixxx!EngineEffect::process+0x124 [c:\projects\mixxx\src\engine\effects\engineeffect.cpp @ 203]
  mixxx!EngineEffectChain::process+0x170 [c:\projects\mixxx\src\engine\effects\engineeffectchain.cpp @ 254]
  mixxx!EngineEffectRack::process+0x1df [c:\projects\mixxx\src\engine\effects\engineeffectrack.cpp @ 79]
  mixxx!EngineEffectsManager::processInner+0x1db [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 222]
  mixxx!EngineEffectsManager::processPostFaderAndMix+0x67 [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 169]
  mixxx!ChannelMixer::applyEffectsAndMixChannels+0x185 [c:\projects\mixxx\src\engine\channelmixer_autogen.cpp @ 48]
  mixxx!EngineMaster::process+0x32d [c:\projects\mixxx\src\engine\enginemaster.cpp @ 428]
  mixxx!SoundDevicePortAudio::callbackProcessClkRef+0x57a [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 941]
  mixxx!`anonymous namespace'::paV19CallbackClkRef+0x27 [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 84]
  mixxx!AdaptingOutputOnlyProcess+0xd2 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1117]
  mixxx!PaUtil_EndBufferProcessing+0x209 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1643]
  mixxx!bufferSwitchTimeInfo+0x364 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\hostapi\asio\pa_asio.cpp @ 3137]
  rlasio64!DllUnregisterServer+0x3abc
  rlasio64!DllUnregisterServer+0x3e30
  rlasio64!DllUnregisterServer+0x3c00
  rlasio64!DllUnregisterServer+0x3af9
  KERNEL32!BaseThreadInitThunk+0x14
  ntdll!RtlUserThreadStart+0x21

Windows 10, 64 bit version
Intel Core i5 @ 1.60 Ghz, 8GB RAM, Intel HD Graphics 3000
Controller: Reloop Beatmix 2 Mk2

mixxx-2.2.0-alpha-pre-master-git6455-release-x64

Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Be (be.ing) wrote :

Can you upload mixxx.cfg and effects.xml as well? Those files are in the same folder as mixxx.log.

Changed in mixxx:
importance: Undecided → Critical
Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Rudolf Gallander (akkarin169) wrote :
Revision history for this message
Be (be.ing) wrote :

Hmmm, my first thought was that this could be a duplicate of Bug #1740531, but looking at the backtrace and the mixxx.cfg that does not seem to be the case...

Revision history for this message
Rudolf Gallander (akkarin169) wrote :

I have been trying to reproduce the crash in multiple older versions:

Can reproduce crash:
mixxx-2.2.0-alpha-pre-master-git6455-release-x64.exe
mixxx-2.1.0-beta1-2.1-git6456-release-x64.exe
mixxx-2.1.0-beta1-2.1-git6450-release-x64.exe
mixxx-2.1.0-alpha-pre-master-git6445-release-x64.exe

Cannot reproduce crash
mixxx-2.1.0-alpha-pre-master-git6428-release-x64.exe
mixxx-2.1.0-alpha-pre-master-git6421-release-x64.exe
mixxx-2.1.0-alpha-pre-master-git6415-release-x64.exe

Further observations:
* The crash only occurs, if I do the steps exactly as described above. It occurs only if both FX units are assigned and are un-assigned before loading the next track. If only one FX unit is used, or if one FX unit remains assigned when loading the next track, the crash will not occur
* The crash occurs as soon as I activate headphone cueing on the newly loaded track (doesn't matter if the track is playing or not)
* It also affects other effects (e.g. Echo).

Here is a stack trace of a crash with Echo effect (mixxx-2.1.0-alpha-pre-master-git6445-release-x64.exe):

Exception #: 0XC0000005
 Stack:
  mixxx!EchoEffect::processChannel+0x2cd [c:\projects\mixxx\src\effects\native\echoeffect.cpp @ 196]
  mixxx!EngineEffect::process+0x124 [c:\projects\mixxx\src\engine\effects\engineeffect.cpp @ 203]
  mixxx!EngineEffectChain::process+0x17a [c:\projects\mixxx\src\engine\effects\engineeffectchain.cpp @ 255]
  mixxx!EngineEffectRack::process+0x1df [c:\projects\mixxx\src\engine\effects\engineeffectrack.cpp @ 79]
  mixxx!EngineEffectsManager::processInner+0x1db [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 222]
  mixxx!EngineEffectsManager::processPostFaderAndMix+0x67 [c:\projects\mixxx\src\engine\effects\engineeffectsmanager.cpp @ 169]
  mixxx!ChannelMixer::applyEffectsAndMixChannels+0x185 [c:\projects\mixxx\src\engine\channelmixer_autogen.cpp @ 48]
  mixxx!EngineMaster::process+0x32d [c:\projects\mixxx\src\engine\enginemaster.cpp @ 428]
  mixxx!SoundDevicePortAudio::callbackProcessClkRef+0x57a [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 941]
  mixxx!`anonymous namespace'::paV19CallbackClkRef+0x27 [c:\projects\mixxx\src\soundio\sounddeviceportaudio.cpp @ 84]
  mixxx!AdaptingOutputOnlyProcess+0xd2 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1117]
  mixxx!PaUtil_EndBufferProcessing+0x209 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\common\pa_process.c @ 1643]
  mixxx!bufferSwitchTimeInfo+0x364 [c:\jenkins\bs-2.1-win\amd64-releasefastbuild\build\pa_stable_v190600_20161030\src\hostapi\asio\pa_asio.cpp @ 3137]
  rlasio64!DllUnregisterServer+0x3abc
  rlasio64!DllUnregisterServer+0x3e30
  rlasio64!DllUnregisterServer+0x3c00
  rlasio64!DllUnregisterServer+0x3af9
  KERNEL32!BaseThreadInitThunk+0x14
  ntdll!RtlUserThreadStart+0x21

Be (be.ing)
Changed in mixxx:
status: New → Confirmed
milestone: none → 2.1.0
assignee: nobody → Be (be.ing)
Be (be.ing)
summary: - Mixxx crashes after using (Moog-) Filter Effect
+ crash enabling PFL after disabling multiple input channels of effect
+ units
Revision history for this message
Be (be.ing) wrote : Re: crash enabling PFL after disabling multiple input channels of effect units

Thank you for the detailed bug report. I'm not sure what is going on yet, but I can reproduce this reliably.

Revision history for this message
Be (be.ing) wrote :

I have an idea of what is going on. When the crash occurs, it is when effects are processed for the channel that headphones are being enabled on and the EffectEnableState is Disabling. This suggests that EngineEffect::process did not get a chance to run with the EffectEnableState as Disabling and set the EffectEnableState to fully Disabled before the EffectState got deleted by EffectProcessorImpl::deleteStatesForInputChannel from the main thread. That would make sense because EngineEffect::process is only executed for PFL when PFL is enabled. However, I am still confused why the issue does not occur when assigning a deck to an effect unit without PFL enabled, unassigning the deck, then enabling PFL. Unassigning two routing switches is required to reproduce the crash.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

During review I had a suspicion that this can happen, because I did not find an explicite sync hock which checks if the last call was done before deleting.
I have tested it by hacking the code up and cue many enable disable commands into the message queue. It did not manage to crash Mixxx and the last call was always processed.
Unfortunately I did not test this with PFL enabled.
So it looks like we need something like a dedicated finish message that is called after the effect id disable. Currently the ack message is used forthat.

Revision history for this message
Be (be.ing) wrote :

Ah-ha, I have reproduced the crash by disabling a single routing switch. Step by step:
1. Load any effect to an effect unit
2. Enable that effect
3. Route a deck which does not have PFL enabled to that effect unit
4. Disable the routing switch
5. Change anything in the effects system. This will trigger EffectsManager::writeRequest which will delete the EffectStates for the disabled input channel
6. Enable PFL on the deck

So I was correct before, the problem is that EngineEffect::process does not get called with EffectEnableState::Disabling for PFL until after the EffectState is deleted because effects are not processed for PFL when PFL is disabled. I'm not immediately sure what the best solution is...

summary: - crash enabling PFL after disabling multiple input channels of effect
- units
+ crash enabling PFL after deleting EffectState while PFL is disabled
Be (be.ing)
Changed in mixxx:
status: Confirmed → In Progress
Revision history for this message
Be (be.ing) wrote :

I figured out a fix. Fortunately it turns out to be quite simple.
https://github.com/mixxxdj/mixxx/pull/1468

Be (be.ing)
Changed in mixxx:
status: In Progress → Confirmed
status: Confirmed → Fix Committed
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/9047

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.