bugGNU Octave - Bugs: bug #60365, segfault at exit after "test...

 
 

bug #60365: segfault at exit after "test audiodevinfo"

Submitter:  Dmitri A. Sergatskov <dasergatskov>
Submitted:  Sat 10 Apr 2021 02:56:32 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Works For Me Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 08 Nov 2022 10:25:59 PM UTC, comment #4: 

The problem is still there (as of Fedora 37 and pipewire 0.3.59).
Except it now triggers by a = audiodevinfo ()
(test ./libinterp/dldfcn/audiodevinfo.cc-tst seems to be OK):


octave:1> a = audiodevinfo ()
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
a =

  scalar structure containing the fields:

    input =

      1x9 struct array containing the fields:

        Name
        DriverVersion
        ID

    output =

      1x14 struct array containing the fields:

        Name
        DriverVersion
        ID


octave:2> quit
fatal: caught signal Segmentation fault -- stopping myself...
Segmentation fault (core dumped)



It is also somewhat intermittent -- running under gdb (./run-octave -g) sometimes does not coredumps. When it does:


 octave:1> a = audiodevinfo ()
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
[New Thread 0x7ffed02ed640 (LWP 2483367)]
[New Thread 0x7ffecfad6640 (LWP 2483370)]
[Thread 0x7ffecfad6640 (LWP 2483370) exited]
[Thread 0x7ffed02ed640 (LWP 2483367) exited]
[New Thread 0x7ffed02ed640 (LWP 2483371)]
[New Thread 0x7ffecfad6640 (LWP 2483374)]
[Thread 0x7ffecfad6640 (LWP 2483374) exited]
[Thread 0x7ffed02ed640 (LWP 2483371) exited]
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
[New Thread 0x7ffed02ed640 (LWP 2483375)]
[New Thread 0x7ffecfad6640 (LWP 2483378)]
[Thread 0x7ffecfad6640 (LWP 2483378) exited]
[Thread 0x7ffed02ed640 (LWP 2483375) exited]
[New Thread 0x7ffed02ed640 (LWP 2483379)]
[New Thread 0x7ffecfad6640 (LWP 2483382)]
[Thread 0x7ffecfad6640 (LWP 2483382) exited]
[Thread 0x7ffed02ed640 (LWP 2483379) exited]
[New Thread 0x7ffed02ed640 (LWP 2483383)]
[Thread 0x7ffed02ed640 (LWP 2483383) exited]
[New Thread 0x7ffed02ed640 (LWP 2483386)]
[New Thread 0x7ffecfad6640 (LWP 2483387)]
a =

  scalar structure containing the fields:

    input =

      1x9 struct array containing the fields:

        Name
        DriverVersion
        ID

    output =

      1x14 struct array containing the fields:

        Name
        DriverVersion
        ID


octave:2> quit

Thread 20 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffecfad6640 (LWP 2483387)]
0x00007ffed0519f40 in ?? ()
Missing separate debuginfos, ...
<...deleted...>
(gdb) thread apply all bt

Thread 20 (Thread 0x7ffecfad6640 (LWP 2483387) "QThread"):
#0  0x00007ffed0519f40 in  ()
#1  0x00007ffed040e48d in loop_iterate (object=0x62d009286428, timeout=<optimized out>) at ../spa/plugins/support/loop.c:430
#2  0x00007ffed0468157 in do_loop (user_data=0x6040014e1090) at ../src/pipewire/data-loop.c:81
#3  0x00007fffee09f822 in start_thread () at /lib64/libc.so.6
#4  0x00007fffee03f450 in clone3 () at /lib64/libc.so.6

<...deleted...>


loop_iterate:


static int loop_iterate(void *object, int timeout)
{
        struct impl *impl = object;
        struct spa_poll_event ep[MAX_EP], *e;
        int i, nfds;

        impl->polling = true;
        spa_loop_control_hook_before(&impl->hooks_list);

        nfds = spa_system_pollfd_wait(impl->system, impl->poll_fd, ep, SPA_N_ELEMENTS(ep), timeout);

        spa_loop_control_hook_after(&impl->hooks_list);
        impl->polling = false;

        struct cancellation_handler_data cdata = { ep, nfds };
        pthread_cleanup_push(cancellation_handler, &cdata);

        /* first we set all the rmasks, then call the callbacks. The reason is that
         * some callback might also want to look at other sources it manages and
         * can then reset the rmask to suppress the callback */
        for (i = 0; i < nfds; i++) {
                struct spa_source *s = ep[i].data;

                spa_assert(s->loop == &impl->loop);

                s->rmask = ep[i].events;
                /* already active in another iteration of the loop,
                 * remove it from that iteration */
                if (SPA_UNLIKELY(e = s->priv))
                        e->data = NULL;
                s->priv = &ep[i];
        }

        if (SPA_UNLIKELY(!spa_list_is_empty(&impl->destroy_list)))
                process_destroy(impl);

        for (i = 0; i < nfds; i++) {
                struct spa_source *s = ep[i].data;
                if (SPA_LIKELY(s && s->rmask))
                        s->func(s);
        } // <--- this is line 431 in loop.c file

        pthread_cleanup_pop(true);

        return nfds;
}


I wonder if we might not closing audidevice correctly at exit?

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 16 Jun 2021 07:43:22 PM UTC, comment #3: 

We probably can close this. After update to pipewire-0.3.30 I do not see the problem anymore.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 11 Apr 2021 12:34:25 AM UTC, comment #2: 

I filled the bug on Fedora's bugzilla:

https://bugzilla.redhat.com/show_bug.cgi?id=1948238

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Sat 10 Apr 2021 11:50:55 PM UTC, comment #1: 

How do we know that this is an Octave issue versus a PipeWire issue?  If PipeWire is new it seems more likely that they didn't implement the interface with PortAudio correctly.

According to gdb, it is thread 19 which caused the SIGSEGV.  Looking at that thread, I see


Thread 19 (Thread 0x7fff529c4640 (LWP 318506) "QThread"):
#0  0x00007fff4f66acb0 in  ()
#1  0x00007fff4f58e0fb in loop_iterate () at /usr/lib64/spa-0.2/support/libspa-support.so
#2  0x00007fff4f5cbd13 in do_loop () at /lib64/libpipewire-0.3.so.0
#3  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#4  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6


It is definitely the pipewire library.  I suppose it is possible that Octave is not calling a PortAudio command to shut things down before exiting, but I don't know very much about PortAudio.

Rik <rik5>
Group administrator
Sat 10 Apr 2021 02:56:32 AM UTC, original submission:  

on Fedora 34 PortAudio server has been replaced by PipeWire.

Now, if I do "test audiodevinfo ; exit", I get a coredump:


octave:2> test audiodevinfo
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side(gdb) threads apply all bt
Undefined command: "threads".  Try "help".
(gdb) t
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
[New Thread 0x7fff529c4640 (LWP 318498)]
[New Thread 0x7fff531cd640 (LWP 318499)]
[Thread 0x7fff531cd640 (LWP 318499) exited]
[Thread 0x7fff529c4640 (LWP 318498) exited]
[New Thread 0x7fff529c4640 (LWP 318500)]
[New Thread 0x7fff531cd640 (LWP 318501)]
[Thread 0x7fff531cd640 (LWP 318501) exited]
[Thread 0x7fff529c4640 (LWP 318500) exited]
[New Thread 0x7fff529c4640 (LWP 318502)]
[New Thread 0x7fff531cd640 (LWP 318503)]
[Thread 0x7fff531cd640 (LWP 318503) exited]
[Thread 0x7fff529c4640 (LWP 318502) exited]
[New Thread 0x7fff529c4640 (LWP 318504)]
[New Thread 0x7fff531cd640 (LWP 318505)]
[Thread 0x7fff531cd640 (LWP 318505) exited]
[Thread 0x7fff529c4640 (LWP 318504) exited]
[New Thread 0x7fff529c4640 (LWP 318506)]
[New Thread 0x7fff531cd640 (LWP 318511)]
PASSES 4 out of 4 tests
octave:3> exit
[Thread 0x7fff5182f640 (LWP 318480) exited]
[Thread 0x7fff5653a640 (LWP 318472) exited]
Missing separate debuginfos,
<...deleted...>
Thread 19 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff529c4640 (LWP 318506)]
0x00007fff4f66acb0 in ?? ()
(gdb) thread apply all bt

Thread 20 (Thread 0x7fff531cd640 (LWP 318511) "PortAudio"):
#0  0x00007fffee6fe9ee in epoll_wait () at /lib64/libc.so.6
#1  0x00007fff4f5975f8 in impl_pollfd_wait () at /usr/lib64/spa-0.2/support/libspa-support.so
#2  0x00007fff4f58e064 in loop_iterate () at /usr/lib64/spa-0.2/support/libspa-support.so
#3  0x00007fff4f60d316 in do_loop () at /lib64/libpipewire-0.3.so.0
#4  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#5  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 19 (Thread 0x7fff529c4640 (LWP 318506) "QThread"):
#0  0x00007fff4f66acb0 in  ()
#1  0x00007fff4f58e0fb in loop_iterate () at /usr/lib64/spa-0.2/support/libspa-support.so
#2  0x00007fff4f5cbd13 in do_loop () at /lib64/libpipewire-0.3.so.0
#3  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#4  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 10 (Thread 0x7fff50680640 (LWP 318481) "QThread"):
#0  0x00007fffee63c052 in sigtimedwait () at /lib64/libc.so.6
#1  0x00007fffee7e053c in sigwait () at /lib64/libpthread.so.0
#2  0x00007ffff76463d2 in __interceptor_sigwait.part.0 () at /lib64/libasan.so.6
#3  0x00007ffff1f35307 in signal_watcher (arg=0x7ffff5da1552 <octave::generic_sig_handler(int)>) at ../liboctave/wrappers/signal-wrappers.c:697
#4  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#5  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 8 (Thread 0x7fff521ad640 (LWP 318478) "QDBusConnection"):
#0  0x00007fffee6f39ff in poll () at /lib64/libc.so.6
#1  0x00007ffff76386aa in poll () at /lib64/libasan.so.6
#2  0x00007fffeda3547c in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#3  0x00007fffed9dec03 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#4  0x00007ffff269d6f8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#5  0x00007ffff264f9b2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#6  0x00007ffff24b749a in QThread::exec() () at /lib64/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#7  0x00007fffe7c90f8b in QDBusConnectionManager::run() () at /lib64/libQt5DBus.so.5
#8  0x00007ffff24b8751 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#9  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#10 0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 5 (Thread 0x7fff53bb8640 (LWP 318475) "gdbus"):
#0  0x00007fffee6f39ff in poll () at /lib64/libc.so.6
#1  0x00007ffff76386aa in poll () at /lib64/libasan.so.6
#2  0x00007fffeda3547c in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#3  0x00007fffed9e0a93 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#4  0x00007fff552acd2a in gdbus_shared_thread_func.lto_priv () at /lib64/libgio-2.0.so.0
#5  0x00007fffeda0fc32 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#6  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#7  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 4 (Thread 0x7fff543cf640 (LWP 318474) "dconf worker"):
#0  0x00007fffee6f39ff in poll () at /lib64/libc.so.6
#1  0x00007ffff76386aa in poll () at /lib64/libasan.so.6
#2  0x00007fffeda3547c in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#3  0x00007fffed9dec03 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#4  0x00007fff54be63ed in dconf_gdbus_worker_thread () at /usr/lib64/gio/modules/libdconfsettings.so
#5  0x00007fffeda0fc32 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#6  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#7  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6

Thread 3 (Thread 0x7fff54bde640 (LWP 318473) "gmain"):
#0  0x00007fffee6f39ff in poll () at /lib64/libc.so.6
#1  0x00007ffff76386aa in poll () at /lib64/libasan.so.6
#2  0x00007fffeda3547c in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#3  0x00007fffed9dec03 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#4  0x00007fffed9dec51 in glib_worker_main () at /lib64/libglib-2.0.so.0
#5  0x00007fffeda0fc32 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#6  0x00007fffee7d6299 in start_thread () at /lib64/libpthread.so.0
#7  0x00007fffee6fe6a3 in clone () at /lib64/libc.so.6
--Type <RET> for more, q to quit, c to continue without paging--

Thread 1 (Thread 0x7fffeaf11340 (LWP 318455) "lt-octave-gui"):
#0  0x00007ffff7602ae9 in __asan::asan_free(void*, __sanitizer::BufferedStackTrace*, __asan::AllocType) () at /lib64/libasan.so.6
#1  0x00007ffff76889f8 in free () at /lib64/libasan.so.6
#2  0x00007fffe7ad6ffd in xkb_context_unref () at /lib64/libxkbcommon.so.0
#3  0x00007fffe7ad886b in xkb_keymap_unref () at /lib64/libxkbcommon.so.0
#4  0x00007fffe7adabec in xkb_state_unref () at /lib64/libxkbcommon.so.0
#5  0x00007fff56584dfe in QXcbConnection::~QXcbConnection() () at /lib64/libQt5XcbQpa.so.5
#6  0x00007fff56584fdd in QXcbConnection::~QXcbConnection() () at /lib64/libQt5XcbQpa.so.5
#7  0x00007fff56585c8e in QXcbIntegration::~QXcbIntegration() () at /lib64/libQt5XcbQpa.so.5
#8  0x00007fff56585d5d in QXcbIntegration::~QXcbIntegration() () at /lib64/libQt5XcbQpa.so.5
#9  0x00007ffff2a81fa0 in QGuiApplicationPrivate::~QGuiApplicationPrivate() () at /lib64/libQt5Gui.so.5
#10 0x00007ffff30e162d in QApplicationPrivate::~QApplicationPrivate() () at /lib64/libQt5Widgets.so.5
#11 0x00007ffff6f2846b in octave::octave_qapplication::~octave_qapplication() (this=0x602000005470, __in_chrg=<optimized out>) at ./../libgui/src/octave-qobject.h:67
#12 0x00007ffff6f28486 in octave::octave_qapplication::~octave_qapplication() (this=0x602000005470, __in_chrg=<optimized out>) at ./../libgui/src/octave-qobject.h:67
#13 0x00007ffff6d81c32 in octave::base_qobject::~base_qobject() (this=0x7fffffffc590, __in_chrg=<optimized out>) at ../libgui/src/octave-qobject.cc:296
#14 0x00007ffff6da38c6 in octave::qt_application::execute() (this=0x7fffffffc7e0) at ../libgui/src/qt-application.cc:71
#15 0x0000000000403bce in main(int, char**) (argc=8, argv=0x7fffffffcb98) at ../src/main-gui.cc:106
(gdb)


Dmitri A. Sergatskov <dasergatskov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-16 rik5 StatusNone Works For Me
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code