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

Segfault when attempting to open LV2 plugin's native UI #1319

Closed
djiamnot opened this issue Nov 22, 2021 · 16 comments
Closed

Segfault when attempting to open LV2 plugin's native UI #1319

djiamnot opened this issue Nov 22, 2021 · 16 comments
Assignees
Milestone

Comments

@djiamnot
Copy link

Platform:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"

On a freshly compiled score from master (as of 2021-11-21), I can see a list of LV2 plugins and use them until I try to open the native interface. It segfaults. I observed the same behaviour on several plugins. Below you will find score's output:

./run.sh 
QVariant::load: unknown user type with name TimeVal.
Using highest available OpenGL version: 4.6
Warning: plugin "/home/mis/src/_externs/score/build/plugins/libscore_lib_base.so" is not a correct score plugin.
Warning: plugin "/home/mis/src/_externs/score/build/plugins/libscore_lib_device.so" is not a correct score plugin.
Warning: plugin "/home/mis/src/_externs/score/build/plugins/libscore_lib_inspector.so" is not a correct score plugin.
Warning: plugin "/home/mis/src/_externs/score/build/plugins/libscore_lib_localtree.so" is not a correct score plugin.
Warning: plugin "/home/mis/src/_externs/score/build/plugins/libscore_lib_state.so" is not a correct score plugin.
pd 0.51.4
bonk version 1.5
fiddle version 1.1 TEST4
pd~ version 0.54
pique 0.1 for PD version 23
sigmund~ version 0.07
error: failed to open file /usr/lib/lv2/gx_colwah.lv2/manifest.ttl (No such file or directory)
lilv_world_load_file(): error: Error loading file `file:///usr/lib/lv2/gx_colwah.lv2/manifest.ttl'
lilv_world_load_bundle(): error: Error reading file:///usr/lib/lv2/gx_colwah.lv2/manifest.ttl
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: CAPTURE 74:D8:3E:60:9A:04 a2dp
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: PLAYBACK 74:D8:3E:60:9A:04 a2dp
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: CAPTURE 74:D8:3E:60:9A:04 a2dp
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: PLAYBACK 74:D8:3E:60:9A:04 a2dp
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: PLAYBACK 74:D8:3E:60:9A:04 a2dp
D: ../../../src/asound/bluealsa-pcm.c:1002: Getting BlueALSA PCM: PLAYBACK 74:D8:3E:60:9A:04 a2dp
error: failed to open file /usr/lib/lv2/gx_wah.lv2/gx_colwah.ttl (No such file or directory)
lilv_world_load_file(): error: Error loading file `file:///usr/lib/lv2/gx_wah.lv2/gx_colwah.ttl'
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
Debug: Audio device emits changed: Dataflow::AudioDevice(0x560fc0ae51c0) (:0)
Debug: Could not save device (:0)
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
Calf Monosynth requires 
Required uri: http://lv2plug.in/ns/ext/urid#map

Calf Monosynth requires 
Required uri: http://lv2plug.in/ns/ext/port-props#supportsStrictBounds
Required uri: http://lv2plug.in/ns/lv2core#hardRTCapable

lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
Warning: QObject::connect: signal not found in color_widgets::Swatch (:0)
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name
lilv_plugin_get_name(): warning: Plugin <http://guitarix.sourceforge.net/plugins/gx_colwah_#_colwah_> has no (mandatory) doap:name

(ossia-score:332466): GLib-GObject-WARNING **: 14:44:42.335: cannot register existing type 'GdkDisplayManager'

(ossia-score:332466): GLib-CRITICAL **: 14:44:42.335: g_once_init_leave: assertion 'result != 0' failed

(ossia-score:332466): GLib-GObject-CRITICAL **: 14:44:42.335: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(ossia-score:332466): GLib-GObject-WARNING **: 14:44:42.335: invalid (NULL) pointer instance

(ossia-score:332466): GLib-GObject-CRITICAL **: 14:44:42.335: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(ossia-score:332466): GLib-GObject-WARNING **: 14:44:42.335: invalid (NULL) pointer instance

(ossia-score:332466): GLib-GObject-CRITICAL **: 14:44:42.335: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(ossia-score:332466): GLib-GObject-WARNING **: 14:44:42.339: cannot register existing type 'GdkDisplay'

(ossia-score:332466): GLib-CRITICAL **: 14:44:42.339: g_once_init_leave: assertion 'result != 0' failed

(ossia-score:332466): GLib-GObject-CRITICAL **: 14:44:42.339: g_type_register_static: assertion 'parent_type > 0' failed

(ossia-score:332466): GLib-CRITICAL **: 14:44:42.339: g_once_init_leave: assertion 'result != 0' failed

(ossia-score:332466): GLib-GObject-CRITICAL **: 14:44:42.339: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
Segmentation fault

and a gdb stacktrace:

#0  0x00007fff91b57aa5 in gdk_display_open () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#1  0x00007fff91b2616a in gdk_display_open_default_libgtk_only () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#2  0x00007fffb4194f4d in gtk_init () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#3  0x00007fffb77827ee in suil_wrapper_new () at /usr/lib/x86_64-linux-gnu/suil-0/libsuil_gtk2_in_qt5.so
#4  0x00007fffbbf6505c in suil_instance_new () at /usr/lib/x86_64-linux-gnu/libsuil-0.so.0
#5  0x00007fffbbfc0f4b in LV2::Window::Window(LV2::Model const&, score::DocumentContext const&, QWidget*) ()
    at /home/mis/src/_externs/score/build/plugins/libscore_plugin_lv2.so
#6  0x00007fffbbfc2d96 in Process::EffectLayerFactory_T<LV2::Model, Process::DefaultEffectItem, LV2::Window>::makeExternalUI(Process::ProcessModel const&, score::DocumentContext const&, QWidget*) const ()
    at /home/mis/src/_externs/score/build/plugins/libscore_plugin_lv2.so
#7  0x00007fffcff9d9b6 in Process::setupExternalUI(Process::ProcessModel const&, Process::LayerFactory const&, score::DocumentContext const&, bool) () at /home/mis/src/_externs/score/build/plugins/libscore_lib_process.so
#8  0x00007ffff5c1c458 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff79c1cc6 in non-virtual thunk to score::QGraphicsPixmapToggle::mousePressEvent(QGraphicsSceneMouseEvent*) () at /home/mis/src/_externs/score/build/plugins/libscore_lib_base.so
#10 0x00007ffff6911b4a in QGraphicsItem::sceneEvent(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff6935627 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff693dacb in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff693dcff in QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff694727a in QGraphicsScene::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff660aa66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff66140f0 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff79d84d5 in SafeQApplication::notify(QObject*, QEvent*) ()
    at /home/mis/src/_externs/score/build/plugins/libscore_lib_base.so
#18 0x00007ffff5bf093a in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#0  0x00007fff91b57aa5 in gdk_display_open () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#1  0x00007fff91b2616a in gdk_display_open_default_libgtk_only () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#2  0x00007fffb4194f4d in gtk_init () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#3  0x00007fffb77827ee in suil_wrapper_new () at /usr/lib/x86_64-linux-gnu/suil-0/libsuil_gtk2_in_qt5.so
#4  0x00007fffbbf6505c in suil_instance_new () at /usr/lib/x86_64-linux-gnu/libsuil-0.so.0
#5  0x00007fffbbfc0f4b in LV2::Window::Window(LV2::Model const&, score::DocumentContext const&, QWidget*) ()
    at /home/mis/src/_externs/score/build/plugins/libscore_plugin_lv2.so
#6  0x00007fffbbfc2d96 in Process::EffectLayerFactory_T<LV2::Model, Process::DefaultEffectItem, LV2::Window>::makeExternalUI(Process::ProcessModel const&, score::DocumentContext const&, QWidget*) const ()
    at /home/mis/src/_externs/score/build/plugins/libscore_plugin_lv2.so
#7  0x00007fffcff9d9b6 in Process::setupExternalUI(Process::ProcessModel const&, Process::LayerFactory const&, score::DocumentContext const&, bool) () at /home/mis/src/_externs/score/build/plugins/libscore_lib_process.so
#8  0x00007ffff5c1c458 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff79c1cc6 in non-virtual thunk to score::QGraphicsPixmapToggle::mousePressEvent(QGraphicsSceneMouseEvent*) () at /home/mis/src/_externs/score/build/plugins/libscore_lib_base.so
#10 0x00007ffff6911b4a in QGraphicsItem::sceneEvent(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff6935627 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff693dacb in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff693dcff in QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff694727a in QGraphicsScene::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff660aa66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff66140f0 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff79d84d5 in SafeQApplication::notify(QObject*, QEvent*) ()
    at /home/mis/src/_externs/score/build/plugins/libscore_lib_base.so
#18 0x00007ffff5bf093a in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007ffff5fdb10b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#38 0x00007ffff5fb535b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#39 0x00007ffff144432e in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#40 0x00007ffff421417d in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#41 0x00007ffff4214400 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#42 0x00007ffff42144a3 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#43 0x00007ffff5c48565 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#44 0x00007ffff5bef4db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#45 0x00007ffff5bf7246 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#46 0x0000555555569b40 in main ()
@jcelerier
Copy link
Member

Thanks, what are the offending plug-ins ?

jcelerier added a commit that referenced this issue Nov 23, 2021
@jcelerier
Copy link
Member

Tried something according to what I could read on the internets, if you can pull and try the above

@jcelerier
Copy link
Member

ah I can reproduce with the Calf plug-ins indeed... :|

@jcelerier
Copy link
Member

hmmm... I tried to check other hosts: Qtractor and LMMS but it seems that neither try to show the native UI for Calf plugs, so I'm wondering if there's a deeper incompatibility here ? I thought the suil library was used to make this work but maybe not... @rncbc any idea if that is just not a tractable problem ? (or did I just miss the open GUI button in Qtractor :x)

@rncbc
Copy link

rncbc commented Nov 23, 2021

qtractor does open both ways: a generic stock GUI (plugin > Properties...) and the plugin's native GUI if it has one (plugin > Edit...).

only qtractor builds of yore Qt5 may use libSUIL; on Qt6, qtractor uses its own LV2UI wrappers to X11 and Gtk2 LV2 GUIs (nb. calf is the later kind); of course, qtractor has to be built with all the necessary support for Gtk2+ development libraries and headers, for it to work or show the Calf GUIs.

@jcelerier
Copy link
Member

okay, when trying here, Plugin > [Edit...] does not open anything so I guess it's my distro's build (which uses Qt6) which lacks the relevant things

@jcelerier
Copy link
Member

jcelerier commented Nov 23, 2021

I think I got it @djiamnot ! To check that it was the same issue than you have, can you try to open the GUI while the score is playing and has reached the LV2 execution ?

@djiamnot
Copy link
Author

djiamnot commented Nov 23, 2021

after a pull and rebuild, score seems to hang after displaying this in the terminal:

QVariant::load: unknown user type with name TimeVal.

(ossia-score:378853): GLib-GObject-WARNING **: 10:54:03.978: cannot register existing type 'GdkDisplayManager'

(ossia-score:378853): GLib-CRITICAL **: 10:54:03.978: g_once_init_leave: assertion 'result != 0' failed

(ossia-score:378853): GLib-GObject-CRITICAL **: 10:54:03.978: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

it does nothing after that, does not open its window, either.

But for the record, the noted issue was with Calf and Gx (guitarix) plugins. Just before the pull I tried with some LSP plugins and Nekobi which appeared to work fine.

@jcelerier
Copy link
Member

jcelerier commented Nov 23, 2021

hummm, could you try using a gtk2 theme like it says here ?
https://bugs.launchpad.net/ubuntu/+source/qtstyleplugins-src/+bug/1874102

@jcelerier
Copy link
Member

jcelerier commented Nov 23, 2021

@jcelerier jcelerier reopened this Nov 23, 2021
@jcelerier
Copy link
Member

hum, so after trying on an ubuntu VM, it turns out that just this code:

#include <QApplication>
#include <QLabel>
#include <dlfcn.h>

int main(int argc, char** argv)
{
  using gdk_init_check_ptr = void *(*)(int*, char***);
  auto gdk = dlopen("libgdk-x11-2.0.so.0", RTLD_LAZY | RTLD_LOCAL);
  auto gdk_init_check = (gdk_init_check_ptr)dlsym(gdk, "gdk_init_check");

  gdk_init_check(nullptr, nullptr);

  QApplication app{argc, argv};

  QLabel label{"foo"};
  label.show();

  return app.exec();
}

fails, because by default on Ubuntu the theme is qgtk3 which already calls gdk_init and calling it twice either hangs or crashes. -_-

@jcelerier
Copy link
Member

in the meantime @djiamnot what you can do is :

sudo apt install qt5-style-plugins
QT_QPA_PLATFORMTHEME=gtk2 ./ossia-score

with that, it seems to work here on a 20.04 VM...

@djiamnot
Copy link
Author

That's so funny! I confirm that it works, however yesterday it was not. It may have been user error, I run fish as default shell and there may be some detail in handling environment variables interaction that escapes me. It now runs correctly in both bash and fish and I can open LV2 native interfaces, including Calf and Gx. Thank you for your patience and sorry for the noise.

@jcelerier
Copy link
Member

no worries, it's not noise, the problem still exists (but I don't see an easy way out of it right now..)

@jcelerier
Copy link
Member

(reported lv2/suil#16 on suil, maybe some answer will come out of it..)

@jcelerier jcelerier self-assigned this Nov 24, 2021
@jcelerier jcelerier added this to the release/3.5 milestone Nov 24, 2021
@jcelerier
Copy link
Member

upstream LV2 / Suil has removed support for displaying GTK2 UIs altogether so this is no longer relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants