brummer10 / guitarix

guitarix virtual versatile amplification for Jack/Linux
254 stars 28 forks source link

GUI crash when using MIDI to change values of knobs #11

Closed Rippert closed 4 years ago

Rippert commented 4 years ago

First, let me say that the MIDI feedback works really well and makes my control surface much more useful with Guitarix. Also, I don't think this is a new bug. I remember seeing this years ago when I first tried out Guitarix, but I wasn't even on github then, and I never really used the MIDI control with guitarix except to change patches and mute. Just tested changing the controls with my expression pedal once, noticed it crashed sometimes when doing that, and then never tried it again.

Crash - when the GUI is open and you use a midi CC to change the value of a knob, such as Drive, Pre Gain, Master Gain, Master Volume, etc, eventually the GUI will crash during a MIDI CC value change. Meaning that guitarix with no switches crashes, but only the guitarix -G instance crashes when using -N and -G instances. It only seems to happen when you send a bunch of CC messages in a row, like stepping on an expression pedal or turning a physical knob on a control surface.

When its the guitarix with no switches crashing, I get this error message:

**
Gtk:ERROR:../../../../gtk/gtkcssinheritvalue.c:33:gtk_css_value_inherit_free: code should not be reached
**
Gtk:ERROR:../../../../gtk/gtkcssinheritvalue.c:33:gtk_css_value_inherit_free: code should not be reached

[2]+  Aborted                 guitarix

I don't have any debugging turned on in the compile. Let me know if you want me to try that again with gdb.

brummer10 commented 4 years ago

Yes please, the debugging output may give a hint were this is triggered.

Rippert commented 4 years ago

The crash takes much longer with the -N and -G instances, so I tried it with just the plain guitarix in gdb. It's not really a segfault, but an abort, so not sure if I was doing the right thing with the backtrace. Here's the output:

gdb --args guitarix
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from guitarix...done.
(gdb) run
Starting program: /usr/bin/guitarix 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x71e5dfd0 (LWP 9229)]
[New Thread 0x715a6fd0 (LWP 9230)]
[New Thread 0x70bfefd0 (LWP 9231)]
[Detaching after fork from child process 9232]
[Detaching after fork from child process 9233]
[New Thread 0x6fb3bfd0 (LWP 9234)]
[New Thread 0x6f33afd0 (LWP 9235)]
mlock 1266460 bytes
[New Thread 0x6a533fd0 (LWP 9236)]
[New Thread 0x6a4b2fd0 (LWP 9237)]
[New Thread 0x65484fd0 (LWP 9238)]
[New Thread 0x652fefd0 (LWP 9239)]
[New Thread 0x64afdfd0 (LWP 9240)]
[New Thread 0x64a7cfd0 (LWP 9241)]
[New Thread 0x649b0fd0 (LWP 9242)]
**
Gtk:ERROR:../../../../gtk/gtkcssnode.c:319:lookup_in_global_parent_cache: assertion failed: (node->cache == NULL)

Thread 11 "guitarix" received signal SIGABRT, Aborted.
[Switching to Thread 0x64afdfd0 (LWP 9240)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt -full
No symbol "full" in current context.
(gdb) bt
#0  0x75504f24 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x754f0230 in __GI_abort () at abort.c:79
#2  0x76cf38a8 in g_assertion_message () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#3  0x76cf3948 in g_assertion_message_expr () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#4  0x767458a4 in  () at /usr/lib/arm-linux-gnueabihf/libgtk-3.so.0
(gdb) bt full
#0  0x75504f24 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        set = 
            {__val = {88583, 0, 1053261418, 1053342094, 1053419778, 1053494426, 1053565995, 1053634453, 1053699749, 1053761858, 1053820736, 1053876350, 1053928676, 1053977684, 1054023357, 1054065691, 1054104679, 1054140331, 1054172658, 1054201680, 1054227429, 1054249934, 1054269227, 1054285349, 1054298316, 1054308162, 1054314905, 1054318557, 1054319127, 1054316627, 1054311056, 1054302428}}
        pid = <optimized out>
        tid = <optimized out>
#1  0x754f0230 in __GI_abort () at abort.c:79
        save_stage = 1
        act = 
          {__sigaction_handler = {sa_handler = 0x10, sa_sigaction = 0x10}, sa_mask = {__val = {0, 4096, 112232, 1675647392, 3746762496, 137, 10227232, 1689244624, 1675647392, 137, 0, 1675635592, 1, 1675635592, 1993283004, 1993915376, 5184544, 1993918356, 0, 5184544, 113, 2298478592, 1993157996, 1675635592, 0, 0, 3746762496, 1675635592, 1675635592, 1993918820, 114, 5184544}}, sa_flags = 1990087232, sa_restorer = 0x64afd434}
        sigs = {__val = {32, 0 <repeats 31 times>}}
#2  0x76cf38a8 in g_assertion_message () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#3  0x76cf3948 in g_assertion_message_expr () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#4  0x767458a4 in  () at /usr/lib/arm-linux-gnueabihf/libgtk-3.so.0
(gdb) bt -full
No symbol "full" in current context.
(gdb) bt -help
No symbol "help" in current context.
(gdb) -help bt
Undefined command: "-help".  Try "help".
(gdb) help bt
Print backtrace of all stack frames, or innermost COUNT frames.
Usage: backtrace [QUALIFIERS]... [COUNT]
With a negative argument, print outermost -COUNT frames.
Use of the 'full' qualifier also prints the values of the local variables.
Use of the 'no-filters' qualifier prohibits frame filters from executing
on this backtrace.
(gdb)

I'll try you new commit next and see if that fixes it.

Rippert commented 4 years ago

Just tried the latest commit. It still crashes. Let me know if you want me to try the gdb thing again with some other commands, or to try any other tests.

brummer10 commented 4 years ago

Yes please send the output from the debugging version, as in the above backtrace we only see the involved system library's, but I need to know were in guitarix the assertion is triggered.

Rippert commented 4 years ago

I wrote a script to pump out a bunch of MIDI commands like an expression pedal, so I was able to get the -G instance to segfault without wearing out my controller.

(gdb) run
Starting program: /usr/bin/guitarix -G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x71e5dfd0 (LWP 22240)]
[New Thread 0x715a6fd0 (LWP 22241)]
[New Thread 0x70bfefd0 (LWP 22242)]
[Detaching after fork from child process 22243]
[Detaching after fork from child process 22244]
[New Thread 0x6fab8fd0 (LWP 22245)]
[Thread 0x6fab8fd0 (LWP 22245) exited]
string-id not found: compressor

Thread 1 "guitarix" received signal SIGSEGV, Segmentation fault.
gx_engine::GxMachineRemote::parameter_changed (this=this@entry=0x7effea6c, 
    jp=jp@entry=0x1068ab0) at ../src/gx_head/gui/machine.cpp:1226
1226        p.set_blocked(true);
(gdb) bt -full
No symbol "full" in current context.
(gdb) bt full
#0  0x001d68e4 in gx_engine::GxMachineRemote::parameter_changed(gx_system::JsonStringParser*) (this=this@entry=0x7effea6c, jp=jp@entry=0x1068ab0)
    at ../src/gx_head/gui/machine.cpp:1226
        p = <error reading variable>
        __PRETTY_FUNCTION__ = "void gx_engine::GxMachineRemote::parameter_changed(gx_system::JsonStringParser*)"
#1  0x001d7294 in gx_engine::GxMachineRemote::handle_notify(gx_system::JsonStringParser*) (this=0x7effea6c, this@entry=0x0, jp=jp@entry=0x1068ab0)
    at ../src/gx_head/gui/machine.cpp:1317
        method = "set"
        __PRETTY_FUNCTION__ = "void gx_engine::GxMachineRemote::handle_notify(gx_system::JsonStringParser*)"
#2  0x001d7b68 in gx_engine::GxMachineRemote::socket_input_handler(Glib::IOCondition) (this=0x0, cond=<optimized out>) at ../src/gx_head/gui/machine.cpp:1434
        p = 0x7effc833 "\n{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\": [\"amp2.stage1.Pregain\",-11.1811]}\n{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\": [\"amp2.stage1.Pregain\",-11.4961]}\n{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\":"...
        n = 1128
        buf = "{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\": [\"amp2.stage1.Pregain\",-0.787401]}\n{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\": [\"amp2.stage1.Pregain\",-1.10236]}\n{\"jsonrpc\": \"2.0\",\"method\": \"set\",\"params\":"...
--Type <RET> for more, q to quit, c to continue without paging--c
        jp = 0x1068ab0
        __PRETTY_FUNCTION__ = "bool gx_engine::GxMachineRemote::socket_input_handler(Glib::IOCondition)"
#3  0x75ba10c0 in Glib::IOSource::dispatch(sigc::slot_base*) () at /usr/lib/arm-linux-gnueabihf/libglibmm-2.4.so.1
#4  0x75ba1318 in Glib::Source::dispatch_vfunc(_GSource*, int (*)(void*), void*) () at /usr/lib/arm-linux-gnueabihf/libglibmm-2.4.so.1
#5  0x76cc9ae8 in g_main_context_dispatch () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#6  0x76cc9e7c in  () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
(gdb)
Rippert commented 4 years ago

Sorry, hit the close switch by error.

brummer10 commented 4 years ago

Hopefully you could close it now. Indeed it was a long outstanding Bug, and I was now able to reproduce and fix it, hopefully.

Rippert commented 4 years ago

Running guitarix as a -N instance and a -G instance, I could not get it to crash. I even tried pumping two knobs simultaneously via MIDI.

Unfortunately it still has a problem when I run it as just a single guitarix instance with no switches. I tried your latest commit and 7ebc58a. I'm afraid it still crashes when I send a continuous stream of MIDI commands. I've got to go for a few days, and won't have access to my test Pi. I'll get back to you on Tuesday if you need me to do more debug sessions. In this case it just seems to Abort, not segfault. If you have a suggestion for how to run a gdb session to get more useful data in that case, let me know.

Are you able to reproduce this case (crashing while running a single guitarix instance and pumping a knob via MIDI)?

Anyway, thank you for this. Running it as the two instances will work for my use case, so I can move forward on integrating the new version into my regular amp rack. The new MIDI feedback and the new plugins, especially the Power Amp plugin, really make it more useful for my Bass amp.

brummer10 commented 4 years ago

Okay, I was first only able to reproduce the crash when running GUI and engine in separate processes, that I could fix. Now, I could reproduce the crash as well in a single instance, and could fix that as well. Try the latest commit and let me know if it works for you when you be back.

Rippert commented 4 years ago

I couldn't get it to crash with the latest commit. Hermann, you are a true hero of the linux audio world!

I'm closing the issue on purpose this time :)