It's a race condition where something in the process thread is not
recognizing the lock taken when removing the module.

I'm 99% this is already fixed in the version I run.

I've got a lot of changes and fixes piled up locally. I'll see if I can dig
this one out and push it since it seems to be troubling you.

Been a bit discouraged with the Linux Audio/free software scene as of late,
what with the fact that people give me demands rather than patches, and
then proceed to rip off my work and slander me in public. It's hard to be
interested in spending the time and effort it takes to publish changes (out
of the goodness of my heart) when I know full well that all I'll receive in
return is abuse.


On Sat, Jan 2, 2021 at 12:29 PM Aaron Duerksen <[email protected]>
wrote:

> Well, I got *something* now, but I'm not entirely sure where to go from
> here.
>
> The core dump is here:
>
> https://drive.google.com/file/d/1ywlMhK6GJRG5lRbGmg12-k04j9L4HJer/view?usp=sharing
>
> And here's the terminal log from that session, after recompiling with
> debugging enabled:
>
>
>
> aaron@aaron-M6800:~$ non-mixer &
> [2] 6332
> aaron@aaron-M6800:~$ The Non-Mixer 1.2.0  -- Copyright (c) 2008-2013
> Jonathan Moore Liles
> [non-mixer] ../nonlib/OSC/Endpoint.C:202 init(): Creating OSC server
> [non-mixer] ../mixer/src/Plugin_Module.C:257 discover_thread():
> Discovering plugins in the background
> WARNING: LADSPA_PATH environment variable not set
>          Assuming /usr/lib/ladspa:/usr/local/lib/ladspa
> OSC=osc.udp://aaron-M6800:16412/
> [non-mixer] ../mixer/src/main.C:310 main(): Running UI...
> [non-mixer] ../nonlib/OSC/Endpoint.C:1156 osc_thread(): OSC Thread running
> X_ChangeProperty: BadValue (integer parameter out of range for operation)
> 0x0
> WARNING: Could not open path /usr/local/lib/ladspa/
> 10 plugins found in 5 libraries
> WARNING: LADSPA_RDF_PATH environment variable not set
>          Assuming /usr/share/ladspa/rdf:/usr/local/share/ladspa/rdf
> WARNING: Could not open path /usr/local/share/ladspa/rdf/
> gdb `which non-mixer` `pidof non-mixer`
> GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
> Copyright (C) 2020 Free Software Foundation,
> Inc.
>
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html> <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 "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>
> <http://www.gnu.org/software/gdb/documentation/>.
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /usr/local/bin/non-mixer...
> Attaching to program: /usr/local/bin/non-mixer, process 6332
> Could not attach to process.  If your uid matches the uid of the target
> process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
> again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
> ptrace: Operation not permitted.
> /home/aaron/6332: No such file or directory.
> (gdb) set logging on
> Copying output to gdb.txt.
> Copying debug output to gdb.txt.
> (gdb) thread apply all bt full
> (gdb) [non-mixer] ../mixer/src/Mixer.C:230 cb_menu(): Picked &Mixer/&Add
> Strip
> [non-mixer] ../mixer/src/Module.C:606 chain(): Module Controller already
> belongs to chain NULL
> Cannot lock down 82280346 byte memory area (Cannot allocate memory)
> Cannot use real-time scheduling (RR/5)(1: Operation not permitted)
> JackClient::AcquireSelfRealTime error
> Cannot lock down 82280346 byte memory area (Cannot allocate memory)
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 0
> Cannot use real-time scheduling (RR/5)(1: Operation not permitted)
> JackClient::AcquireSelfRealTime error
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module (null) in to
> chain Unnamed
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Controller in
> to chain Unnamed
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Controller in
> to chain Unnamed
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Controller in
> to chain Unnamed
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Meter
> Indicator in to chain Unnamed
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module JACK in to
> chain Unnamed
> [non-mixer] ../nonlib/JACK/Port.C:193 activate(): Activating port name in-1
> [non-mixer] ../nonlib/JACK/Port.C:207 activate(): Port = 0x5
> [non-mixer] ../mixer/src/Mixer.C:1155 auto_connect(): Full auto-connect
> cycle
> [non-mixer] ../mixer/src/Module.C:606 chain(): Module JACK already belongs
> to chain Unnamed
> [non-mixer] ../mixer/src/Mixer_Strip.C:440 handle_module_added():
> Connecting controls to default module "JACK"
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 1
> [non-mixer] ../mixer/src/Chain.C:629 insert(): Module "JACK" has 0:1 audio
> and 2:0 control ports
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Gain in to
> chain Unnamed
> [non-mixer] ../mixer/src/Module.C:606 chain(): Module Gain already belongs
> to chain Unnamed
> [non-mixer] ../mixer/src/Mixer_Strip.C:440 handle_module_added():
> Connecting controls to default module "Gain"
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 1
> [non-mixer] ../mixer/src/Chain.C:629 insert(): Module "Gain" has 1:1 audio
> and 2:0 control ports
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Meter in to
> chain Unnamed
> [non-mixer] ../mixer/src/Mixer_Strip.C:440 handle_module_added():
> Connecting controls to default module "Meter"
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 1
> [non-mixer] ../mixer/src/Chain.C:629 insert(): Module "Meter" has 1:1
> audio and 0:1 control ports
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module JACK in to
> chain Unnamed
> [non-mixer] ../mixer/src/Module.C:606 chain(): Module JACK already belongs
> to chain Unnamed
> [non-mixer] ../nonlib/JACK/Port.C:193 activate(): Activating port name
> out-1
> [non-mixer] ../nonlib/JACK/Port.C:207 activate(): Port = 0x6
> [non-mixer] ../mixer/src/Mixer_Strip.C:440 handle_module_added():
> Connecting controls to default module "JACK"
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 1
> [non-mixer] ../mixer/src/Chain.C:629 insert(): Module "JACK" has 1:0 audio
> and 2:0 control ports
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 1
> [non-mixer] ../mixer/src/Mixer.C:755 add(): Add mixer strip "Unnamed"
> [non-mixer] ../mixer/src/Module.C:843 insert_menu_cb(): picked = Mono Pan
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Mono Pan in
> to chain Unnamed
> [non-mixer] ../nonlib/JACK/Port.C:193 activate(): Activating port name
> out-2
> [non-mixer] ../nonlib/JACK/Port.C:207 activate(): Port = 0x7
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 2
> [non-mixer] ../mixer/src/Chain.C:629 insert(): Module "Mono Pan" has 1:2
> audio and 1:0 control ports
> [non-mixer] ../mixer/src/Module.C:1397 command_open_parameter_editor():
> Opening module parameters for "Mono Pan"
> [non-mixer] ../mixer/src/Module_Parameter_Editor.C:621 menu_cb(): Bind
> [non-mixer] ../mixer/src/Module.C:595 chain(): Adding module Pan in to
> chain Unnamed
> [non-mixer] ../mixer/src/Chain.C:375 configure_ports(): required_buffers =
> 2
> [non-mixer] ../mixer/src/Chain.C:308 remove(): Removing controller module
> from chain
> thread apply all bt full
> (gdb) quit
> [2]+  Segmentation fault      (core dumped) non-mixer
> aaron@aaron-M6800:~$ gdb `which non-mixer` core
> GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
> Copyright (C) 2020 Free Software Foundation,
> Inc.
>
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html> <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 "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>
> <http://www.gnu.org/software/gdb/documentation/>.
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /usr/local/bin/non-mixer...
> [New LWP 6362]
> [New LWP 6332]
> [New LWP 6334]
> [New LWP 6361]
> [New LWP 6360]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by `non-mixer'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00005562fe5421ff in Chain::process (this=0x5562ff9c0660,
> nframes=1024) at ../mixer/src/Chain.C:906
> 906             m->process( nframes );
> [Current thread is 1 (Thread 0x7f1c023f4700 (LWP 6362))]
> (gdb) quit
> aaron@aaron-M6800:~$
>
>
>
> gdb.txt is present but still empty after all that.
>
>
>
> The seemingly relevant sections of code are Chain.C:308, which includes
> the last debug message as I removed the control:
>
> void
> Chain::remove ( Controller_Module *m )
> {
>     DMESSAGE( "Removing controller module from chain" );
>
>     client()->lock();
>
>     m->disconnect();
>
>     controls_pack->remove( m );
>     modules_pack->remove( m );
>
>     build_process_queue();
>
>     client()->unlock();
>
>     redraw();
> }
>
> and Chain.C:906, which has the segfault itself:
>
> /**********/
> /* Client */
> /**********/
>
> void
> Chain::process ( nframes_t nframes )
> {
>     for ( std::list<Module*>::const_iterator i = process_queue.begin(); i
> != process_queue.end(); ++i )
>     {
>         Module *m = *i;
>
>         m->process( nframes );  // <-- segfault here
>     }
> }
>
> Looks to me like something's not getting removed completely.  Maybe a
> multithreaded race condition that always loses on my machine?  (yes, I know
> the removal is inside a lock, but anything can have bugs in it, including
> the lock structure or perhaps more likely its use)
>
>
>
> ------------------------------
> *From:* John Rigg
> *Sent:* Saturday, January 02, 2021 3:16AM
> *To:* Non
> *Subject:* Re: [non] Segfault when deleting a control
>
> On Fri, Jan 01, 2021 at 09:51:35AM -0600, Aaron Duerksen wrote:
>
> 1. Start non-mixer
> 2. Add a strip
> 3. Add a Mono Pan, or anything else, really
> 4. Bind a control from it
> 5. Remove that control
> 6. Segfault
>
> This happens every time, as demonstrated in this 45-second video 
> screenshot:https://www.youtube.com/watch?v=9mmC_ODMmfo
>
> I would review the core dump and include at least parts of it here, if I
> knew where it was.?? Lubuntu 20.04
>
> I would also create a ticket on GitHub, if I could figure out how. I can see
> the existing issues and read them, but I can't figure out how to add one,
> even after creating an account.?? The obvious eye-catching way seems to
> dead-end.
>
> The 'issues' link on the GitHub page was recently removed, so I guess
> this list is the official way to report bugs.
>
> If you haven't already read it, see the bug reporting page 
> athttps://non.tuxfamily.org/wiki/BugReports (ignoring references
> to GitHub).
>
> A gdb backtrace will be helpful. You'll need to compile non with
> debugging enabled, ie.:
> ./waf configure --enable-debug
>
> John
>
>
>
>

Reply via email to