Staging-2210 Snapshot Loading

@pianissimo do you have a stream of MIDI feeding your unit, e.g. MIDI clock? Does the error occur if you (pysically) disconnect all MIDI devices before shutdown?

Ignore that - I can reproduce the issue and am investigating…

How are you shutting down the Zynthian?

Normally I do a long-press on the Zynthians Kit select-rotary-button. After this I turn of my Stage Piano (Korg SV-1) which is connected to the Zynthians MIDI-IN socket.

Here are the two snapshots I used :
001-Test.zss (25.3 KB)
006-San Jacinto.zss (29.4 KB)


And here to UI log:
Oct 23 11:28:39 zynthian startx[476]: ERROR:zynthian_gui.zyngine_refresh: Control thread failed to terminate
Oct 23 11:28:39 zynthian startx[476]: ZynCore: Setting-up 8 x Zynswitches…
Oct 23 11:28:39 zynthian startx[476]: ZynCore: Setting-up 4 x Zynpots (zyncoders)…
Oct 23 11:28:39 zynthian startx[476]: New instance of zynseq
Oct 23 11:28:39 zynthian startx[476]: zynseq initialising as zynseq
Oct 23 11:28:40 zynthian startx[476]: /zynthian/config/img/fb_zynthian_message.png is 480x320 PNG image, color type GRAY, 8 bit
Oct 23 11:28:40 zynthian startx[476]: Zooming image by 100%…done
Oct 23 11:28:40 zynthian startx[476]: Merging…done
Oct 23 11:28:40 zynthian startx[476]: Building XImage…done

It seems to mostly (exclusively?) happen when there is an instance of zynaddsubfx running. I have proven this is due to the control thread taking too long to stop but extending the timeout does resolve it so the thread is not deadlocked, i.e. it does exit eventually. The delay seems to depend on the quantity / complexity of engines running so extending the timeout isn’t an optimal solution.

I have traced this to the control thread calling the shutdown method and not returning and exiting. Thanks for helping to get this far. I need to figure out how best to resolve this…

Right! Let’s hope this has it sorted… I have committed fixes to _testing_branch. The main issue was that MIDI autoconnect was running during exit with a deadlock (or at least long wait) for mutex to be released. Fixing this exposed another issue with OSC callback running after OSC server was destroyed.

@pianissimo please test and let me know if we have nailed this.

Hello @riban ,
it seems the shutdown issue is fixed now :slight_smile:. Some weeks ago I posted some issues with ZynAddSubFX. Perhaps this issue has the same root cause also within the shutdown problem and the MIDI auto connection. Now shutdown is working fine. But shutdown time maybe depends on the amount of instruments loaded. It takes I would say between 10 and 25 seconds with my setup.
Here the part of the log during shutdown:
Oct 23 19:32:59 zynthian startx[536]: ZynCore: Setting-up 8 x Zynswitches…
Oct 23 19:32:59 zynthian startx[536]: ZynCore: Setting-up 4 x Zynpots (zyncoders)…
Oct 23 19:32:59 zynthian startx[536]: New instance of zynseq
Oct 23 19:32:59 zynthian startx[536]: zynseq initialising as zynseq
Oct 23 19:33:00 zynthian startx[536]: /zynthian/config/img/fb_zynthian_message.png is 480x320 PNG image, color type GRAY, 8 bit
Oct 23 19:33:00 zynthian startx[536]: Zooming image by 100%…done
Oct 23 19:33:00 zynthian startx[536]: Merging…done
Oct 23 19:33:00 zynthian startx[536]: Building XImage…done

This is going to be one fine audio clip at the end of this…

I concur - long shutdown times. I just counted to 48s with 4 chains. Please add a ticket to github issue tracker. We are now completely focused on getting the next stable release out so only addressing tickets that we have triaged as required in the new release. Cheers!