Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash When Carla Rack or Patchbay is Replaced #5883

Open
tinkerlevu opened this issue Jan 17, 2021 · 3 comments
Open

Crash When Carla Rack or Patchbay is Replaced #5883

tinkerlevu opened this issue Jan 17, 2021 · 3 comments
Labels

Comments

@tinkerlevu
Copy link

Bug Summary

LMMS crashes or becomes unstable after Carla Rack or Patchbay instrument is replaced while its GUI is still active

Steps to reproduce

  1. Add a Carla Rack or Patchbay instrument to the song editor.
  2. Open that Carla instrument and click on 'Show GUI'
  3. Drag another instrument from the 'Instrument Plugins' panel and drop it on top of the existing Carla instrument
  4. Sit back, grab some popcorn and watch the fireworks...
  5. If LMMS doesn't immediately crash, grab another Carla instrument and add it to the song editor

if the steps above don't result in a crash, try moving the Carla window to a different workspace.

Expected behavior

The Carla Rack/Patchbay instrument gets replaced by the new instrument that was dropped on top of it.

Actual behavior

LMMS crashes swiftly or becomes very unstable and crashes if the user tries adding or changing more unrelated instruments.

Note:

Some instruments do not trigger this crash(???)
From my testing, LB302 sometimes works fine initially, but LMMS crashes if another Carla instrument is added
Kicker sometimes works fine if the Carla window is in the same workspace.

Affected LMMS versions

1.2.1
1.2.1.701 (#5499)
1.3.0 alpha
1.3.0 alpha 1.44+g97114fb (#5846 (comment))

Logs

Click to expand
~/Downloads$ ./lmms-1.3.0-alpha.1.33+g4f74151-linux-x86_64.AppImage 
Carla appears to be installed on this system at /usr/lib[64]/carla so we'll use it.
Jack appears to be installed on this system, so we'll use it.
Lv2 plugin SUMMARY: 95 of 188  loaded in 1556 msecs.
For details about not loaded plugins, please set
  environment variable "LMMS_LV2_DEBUG" to nonempty.
Lv2 Plugins blacklisted: 2 of 188 
  If you want to ignore the blacklist (dangerous!), please set
  environment variable "LMMS_IGNORE_BLACKLIST" to nonempty.
Trying to start carla-plugin using "/usr/share/carla/resources/carla-plugin-patchbay"
LRDF Support not available (LADSPA-RDF will be disabled)
Carla 2.1.0 started, status:
  Python version: 3.8.5
  Qt version:     5.12.8
  PyQt version:   5.14.1
  Binary dir:     /usr/lib/carla
  Resources dir:  /usr/share/carla/resources
ALL OK!
qt.svg: :552:178: Could not resolve property: #linearGradient5167
qt.svg: :30274: Could not resolve property: #linearGradient5167
qt.svg: :30274: Could not resolve property: #pattern5614
qt.svg: :30274: Could not resolve property: #pattern5626
qt.svg: :5672: Could not resolve property: #radialGradient3709
qt.svg: :3226: Could not resolve property: #linearGradient3893-1
qt.svg: :3190: Could not resolve property: #linearGradient3893-1
qt.svg: :3208: Could not resolve property: #linearGradient3893-1
Frontend pixel ratio is 1.0
Got SIGTERM -> Closing now
CarlaPipeCommon::_writeMsgBuffer(..., 15) - failed with -1 (true), message was:
__carla-quit__
Trying to start carla-plugin using "/usr/share/carla/resources/carla-plugin-patchbay"
LRDF Support not available (LADSPA-RDF will be disabled)
Carla 2.1.0 started, status:
  Python version: 3.8.5
  Qt version:     5.12.8
  PyQt version:   5.14.1
  Binary dir:     /usr/lib/carla
  Resources dir:  /usr/share/carla/resources
ALL OK!
qt.svg: :552:178: Could not resolve property: #linearGradient5167
qt.svg: :30274: Could not resolve property: #linearGradient5167
qt.svg: :30274: Could not resolve property: #pattern5614
qt.svg: :30274: Could not resolve property: #pattern5626
qt.svg: :5672: Could not resolve property: #radialGradient3709
qt.svg: :3226: Could not resolve property: #linearGradient3893-1
qt.svg: :3190: Could not resolve property: #linearGradient3893-1
qt.svg: :3208: Could not resolve property: #linearGradient3893-1
Frontend pixel ratio is 1.0
Got SIGTERM -> Closing now
CarlaPipeCommon::_writeMsgBuffer(..., 15) - failed with -1 (true), message was:
__carla-quit__
/tmp/.mount_lmms-1Jt8EDB/AppRun: line 24: 34297 Segmentation fault      (core dumped) QT_X11_NO_NATIVE_MENUBAR=1 "$DIR"/usr/bin/lmms.real "$@"
@tinkerlevu tinkerlevu added the bug label Jan 17, 2021
@zonkmachine
Copy link
Member

zonkmachine commented Jan 17, 2021

Confirmed. I don't have debug symbols in my carla, it's the default ubuntu-20.10. The last native code line touched is at /home/zonkmachine/builds/lmms/plugins/carlabase/carla.cpp:453

fDescriptor->ui_show(fHandle, visible);

Crash when dropping a BitInvader over a Carla Rack with the gui open.

Thread 1 "lmms" received signal SIGSEGV, Segmentation fault.
0x00007fffacd575b8 in ?? () from /usr/lib/carla/libcarla_native-plugin.so
(gdb) bt full
#0  0x00007fffacd575b8 in  () at /usr/lib/carla/libcarla_native-plugin.so
#1  0x00007fffacd4d522 in  () at /usr/lib/carla/libcarla_native-plugin.so
#2  0x00007fffad0dd012 in CarlaInstrumentView::toggleUI(bool) (this=0x555557f63080, visible=false)
    at /home/zonkmachine/builds/lmms/plugins/carlabase/carla.cpp:453
#3  0x00007fffad0dcf4d in CarlaInstrumentView::~CarlaInstrumentView() (this=0x555557f63080, __in_chrg=<optimized out>)
    at /home/zonkmachine/builds/lmms/plugins/carlabase/carla.cpp:436
#4  0x00007fffad0dcf92 in CarlaInstrumentView::~CarlaInstrumentView() (this=0x555557f63080, __in_chrg=<optimized out>)
    at /home/zonkmachine/builds/lmms/plugins/carlabase/carla.cpp:437
#5  0x000055555596e9f9 in InstrumentTrackWindow::updateInstrumentView() (this=0x555557c715e0)
    at /home/zonkmachine/builds/lmms/src/tracks/InstrumentTrack.cpp:1706
#6  0x0000555555749cf9 in InstrumentTrackWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
    (_o=0x555557c715e0, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fffffffbfe0)
    at /home/zonkmachine/builds/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_InstrumentTrack.cpp:460
        _t = 0x555557c715e0
#7  0x00007ffff65a6320 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x0000555555749793 in InstrumentTrack::instrumentChanged() (this=0x7ffff2687e80)
    at /home/zonkmachine/builds/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_InstrumentTrack.cpp:212
#9  0x0000555555968fae in InstrumentTrack::loadInstrument(QString const&, Plugin::Descriptor::SubPluginFeatures::Key const*, bool)
    (this=0x7ffff2687e80, _plugin_name=..., key=0x0, keyFromDnd=true) at /home/zonkmachine/builds/lmms/src/tracks/InstrumentTrack.cpp:969
#10 0x000055555596ef7e in InstrumentTrackWindow::dropEvent(QDropEvent*) (this=0x555557c715e0, event=0x7fffffffc4a0)
    at /home/zonkmachine/builds/lmms/src/tracks/InstrumentTrack.cpp:1814
        type = {static null = {<No data fields>}, d = 0x5555580a1c60}
        value = {static null = {<No data fields>}, d = 0x55555808b760}

If I remove that line and the #if/endif on lines 444 and 452 so we test for the function argument 'visible', then I don't get this crash.

diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp
index 728a6d804..4d738af30 100644
--- a/plugins/carlabase/carla.cpp
+++ b/plugins/carlabase/carla.cpp
@@ -441,7 +441,7 @@ void CarlaInstrumentView::toggleUI(bool visible)
     if (fHandle != NULL && fDescriptor->ui_show != NULL) {
 // TODO: remove when fixed upstream
 // change working path to location of carla.dll to avoid conflict with lmms
-#if defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64)
+
         if (visible) {
             QString backupDir = QDir::currentPath();
             QDir::setCurrent(carla_get_library_folder());
@@ -449,8 +449,6 @@ void CarlaInstrumentView::toggleUI(bool visible)
             QDir::setCurrent(backupDir);
             return;
         }
-#endif
-        fDescriptor->ui_show(fHandle, visible);
     }
 }

@PhysSong
Copy link
Member

Reproduced with Carla 2.2.0. With Valgrind, I detected some use after free which seems related to the crash.

==25936== Invalid read of size 8
==25936==    at 0x2E83EFAD: ??? (in /usr/lib64/carla/libcarla_native-plugin.so)
==25936==    by 0x2E83F67E: ??? (in /usr/lib64/carla/libcarla_native-plugin.so)
==25936==    by 0x2E7912C9: CarlaInstrumentView::~CarlaInstrumentView() (in /home/phys/dev/mylmms/build/plugins/libcarlabase.so)
==25936==    by 0x2E7912E8: CarlaInstrumentView::~CarlaInstrumentView() (in /home/phys/dev/mylmms/build/plugins/libcarlabase.so)
==25936==    by 0x6FE62E: InstrumentTrackWindow::updateInstrumentView() (in /home/phys/dev/mylmms/build/lmms)
==25936==    by 0x61CE8FF: ??? (in /usr/lib64/libQt5Core.so.5.15.2)
==25936==    by 0x6FCB31: InstrumentTrack::loadInstrument(QString const&, Plugin::Descriptor::SubPluginFeatures::Key const*, bool) (in /home/phys/dev/mylmms/build/lmms)
==25936==    by 0x705982: InstrumentTrackWindow::dropEvent(QDropEvent*) (in /home/phys/dev/mylmms/build/lmms)
==25936==    by 0x704EE0: InstrumentTrackView::dropEvent(QDropEvent*) (in /home/phys/dev/mylmms/build/lmms)
==25936==    by 0x6EDEA0: TrackLabelButton::dropEvent(QDropEvent*) (in /home/phys/dev/mylmms/build/lmms)
==25936==    by 0x4A7535D: QWidget::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.15.2)
==25936==    by 0x4A3550E: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib64/libQt5Widgets.so.5.15.2)
==25936==  Address 0x7b71e78 is 104 bytes inside a block of size 728 free'd
==25936==    at 0x483AEAB: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25936==    by 0x2E7905AC: CarlaInstrument::~CarlaInstrument() (in /home/phys/dev/mylmms/build/plugins/libcarlabase.so)

@anytizer
Copy link
Contributor

anytizer commented Feb 7, 2023

Carla Patchbay and Rack now appear when compiled under Visual Studio 2022. But as soon as it is clicked in order to drag into editor, it crashes.

In both cases, it is: fHandle = fDescriptor->instantiate(&fHost); at Carla.cpp line 190.

Exception thrown: read access violation.
this->fDescriptor was nullptr.

https://github.com/LMMS/lmms/blob/master/plugins/CarlaBase/Carla.cpp#L190

Probably looking for resourceDir /resources and its contents which might be missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants