RareBreeds / Orbits

VCV Rack Plugin
Other
6 stars 0 forks source link

Eugene crashes when selecting a preset via Stoermelder 8facemk2 #3

Closed chinenual closed 1 year ago

chinenual commented 1 year ago

I am getting a consistent crash whenever I try to use 8face to preserve Eugene state. I can "record" a preset, but whenever I try to playback one of the recorded presets, it crashes rack.

How to reproduce: Use the attached vcv patch. Click 8face's R/W toggle to "w". Press the first green button (.). Clock the R/W toggle back to "r". The press the first green button to "recall" the preset you just saved. Boom!

A representative crash:

Thread 7 Crashed:
0   libGL.dylib                         0x7ffa29acb78f glDeleteFramebuffers + 18
1   libRack.dylib                          0x1020b04b6 nvgluDeleteFramebuffer(NVGLUframebuffer*) + 38
2   libRack.dylib                          0x10218b996 rack::widget::FramebufferWidget::~FramebufferWidget() + 54
3   libRack.dylib                          0x10218ba9e rack::widget::FramebufferWidget::~FramebufferWidget() + 14
4   libRack.dylib                          0x10218cf91 rack::widget::Widget::clearChildren() + 113
5   libRack.dylib                          0x10218ce66 rack::widget::Widget::~Widget() + 38
6   libRack.dylib                          0x10214f2a8 rack::app::SvgPanel::~SvgPanel() + 72
7   libRack.dylib                          0x10212d3b1 rack::app::ModuleWidget::setPanel(std::__1::shared_ptr<rack::window::Svg>) + 161
8   plugin.dylib                           0x10d9dc05d OrbitsWidget::loadTheme(int) + 189
9   plugin.dylib                           0x10d9dc3ac OrbitsWidget::loadTheme(char const*) + 204
10  libRack.dylib                          0x10217d6ef rack::engine::Module::fromJson(json_t*) + 735
11  libRack.dylib                          0x102178990 rack::engine::Engine::moduleFromJson(rack::engine::Module*, json_t*) + 48
12  plugin.dylib                           0x10a272260 StoermelderPackOne::EightFaceMk2::EightFaceMk2Module<8>::processWorker(int) + 944
13  plugin.dylib                           0x10a27111f StoermelderPackOne::TaskWorker::processWorker() + 127
14  plugin.dylib                           0x10a2712fe void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (StoermelderPackOne::TaskWorker::*)(), StoermelderPackOne::TaskWorker*> >(void*) + 62
15  libsystem_pthread.dylib             0x7ff810abd4e1 _pthread_start + 125
16  libsystem_pthread.dylib             0x7ff810ab8f6b thread_start + 15

eugene.vcv.zip

RareBreeds commented 1 year ago

Hello! Thanks for the detailed bug report.

Looks like it crashed because 8face calls moduleFromJson from a thread other than the main thread. My JSON has the module's theme in it so ends up calling GL functions, which you're not allowed to call from other threads.

Just noticed the 8face docs warn about potential crashes, but it wasn't too difficult to prevent the crash once I figured out what was going on... and modulating between different presets does sound useful.

https://github.com/stoermelder/vcvrack-packone/blob/v2/docs/EightFaceMk2.md

Disclaimer: Loading presets of modules was not designed to be controlled by CV or modulated at audio rate. Please do not contact the developers of Rack or any modules when unexpected behaviour occurs (i.e. crashes) or high CPU usage is noticeable.