mobius-looper / mobius

Other
19 stars 4 forks source link

Gig Performer crashes when closing while Mobius has active tracks #6

Closed cllunsford closed 9 months ago

cllunsford commented 9 months ago

If I try to close Gig Performer while Mobius has any active tracks, it will crash GP

Seen on v2.5.1-rc.1

cllunsford commented 9 months ago

Reproduced with Gig Performer 4.5.8 on Windows 10.

Steps:

  1. Create new Empty Gig in GP
  2. Add Mobius2 VST Plugin to Rack
  3. Open Mobius2 Window
  4. Set Track to Active and start Record
  5. While track is recording, close the GP4 Window
  6. GP4 will close but then report a crash

GP Crash Report

cllunsford commented 9 months ago

After upgrading to Gig Performer 4.8.2, I'm no longer able to reproduce this issue locally. Going to try and downgrade to 4.5.8 and test again to confirm.

cllunsford commented 9 months ago

Confirmed that downgrading back to 4.5.8 reintroduces the bug, and upgrading back to 4.8.2 fixes it again. Compared debug log for the two versions during shutdown.

In 4.5.8:

00000189    12.58102036 [22684] Closing VST UI: Mobius 2    
00000190    12.58106422 [22684] VstEditor::close    
00000191    12.58114719 [22684] 0 0: MobiusPlugin::closeWindow closing dual window thread   
00000192    12.58119869 [22684] 0 0: PluginThread: stopping 
00000193    12.58406353 [22684] 0 0: PluginThread: frame no longer running  
00000194    12.68434906 [22684] 0 0: PluginThread: deleting frame   
00000195    12.77025318 [22684] 0 0: SyncTracker Host: Beat pulse 19 advance 24000 drift 0  
00000196    12.77027130 [22684] 101 288000: Sync: Recording pulse 12 cyclePulses 4 boundary 1   
00000197    12.88530922 [22684] 0 0: PluginThread: frame deleted    
00000198    12.88635921 [22684] VstMobius::DllMain DLL_THREAD_DETACH    
00000199    12.98571301 [22684] MobiusPlugin::windowClosing 
00000200    12.98607159 [22684] 0 0: MobiusPlugin::closeWindow closing dual window frame    
00000201    13.06791687 [22684] VstMobius::suspend  
00000202    13.06796455 [22684] VstMobius::resume   
00000203    13.06808472 [22684] VstMobius::stopProcess  
00000204    13.06812763 [22684] VstMobius::suspend  
00000205    13.06821346 [22684] VstMobius::close    
00000206    13.06824684 [22684] VstMobius::~VstMobius 0000013A7DE2A5B0  
00000207    13.26960182 [22684] VstMobius::DllMain DLL_THREAD_DETACH    
00000208    13.54561424 [22684] 0 0: Mobius: 1 MobiusConfigs on the history list

with 4.8.2:

00000216    12.35181141 [20452] Closing VST UI: Mobius 2    
00000217    12.35187721 [20452] VstEditor::close    
00000218    12.35195160 [20452] 0 0: MobiusPlugin::closeWindow closing dual window thread   
00000219    12.35201645 [20452] 0 0: PluginThread: stopping 
00000220    12.35424519 [20452] 0 0: PluginThread: frame no longer running  
00000221    12.45487976 [20452] 0 0: PluginThread: deleting frame   
00000222    12.55623436 [20452] 0 0: SyncTracker Host: Beat pulse 22 advance 24000 drift 0  
00000223    12.55634689 [20452] 101 360000: Sync: Recording pulse 15 cyclePulses 4 boundary 0   
00000224    12.65674782 [20452] 0 0: PluginThread: frame deleted    
00000225    12.65910721 [20452] VstMobius::DllMain DLL_THREAD_DETACH    
00000226    12.75685883 [20452] MobiusPlugin::windowClosing 
00000227    12.75706387 [20452] 0 0: MobiusPlugin::closeWindow closing dual window frame    
00000228    12.86421967 [20452] VstMobius::suspend  
00000229    12.87320328 [20452] VstMobius::resume   
00000230    12.88091564 [20452] VstMobius::stopProcess  
00000231    12.88672829 [20452] VstMobius::suspend  
00000232    12.89140606 [20452] VstMobius::close    
00000233    12.90190983 [20452] VstMobius::~VstMobius 0000022D99352360  
00000234    13.09312057 [20452] VstMobius::DllMain DLL_THREAD_DETACH    
00000235    13.29406548 [20452] 0 0: Mobius: 1 MobiusConfigs on the history list    
00000236    13.29590225 [20452] 0 0: Flushing object pools  
00000237    13.29634857 [20452] 0 0: MidiTimer: deactivating millisecond timer  
00000238    13.39716625 [20452] VstMobius::~VstMobius finished  
00000239    13.39735985 [20452] VstEditor::~VstEditor   
00000240    13.39758015 [20452] VstMobius::DllMain DLL_PROCESS_DETACH   

The main difference being that 4.5.8 crashes between these two lines and does not continue to Flushing object pools :

00000235    13.29406548 [20452] 0 0: Mobius: 1 MobiusConfigs on the history list    
00000236    13.29590225 [20452] 0 0: Flushing object pools  
00000237    13.29634857 [20452] 0 0: MidiTimer: deactivating millisecond timer  
00000238    13.39716625 [20452] VstMobius::~VstMobius finished  
00000239    13.39735985 [20452] VstEditor::~VstEditor   
00000240    13.39758015 [20452] VstMobius::DllMain DLL_PROCESS_DETACH   

Here's what is happening between these two in deconstructor: https://github.com/mobius-looper/mobius/blob/b6421c9303c0f3b0d9fabb985a114e091aedc12d/src/mobius/Mobius.cpp#L800-L853

cllunsford commented 9 months ago

I don't see anything obvious in the GP4 release notes between 4.5.8 and 4.8.2, but due to the fact that this has only happened in GP4 and looks to be resolved, I will close this issue for now.

cllunsford commented 9 months ago

After some testing, it looks like the same pointer truncation bug causing #5 is also the cause of this issue, as the failure happens when iterating through actions and attempting to clean them up. No longer able to reproduce in GP4 4.5.8 after patching for #5 .