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

DeviceAPI::removeSinkBuddy core dump at destruction time #359

Closed
f4exb opened this issue Jun 4, 2019 · 2 comments
Closed

DeviceAPI::removeSinkBuddy core dump at destruction time #359

f4exb opened this issue Jun 4, 2019 · 2 comments
Labels
Milestone

Comments

@f4exb
Copy link
Owner

f4exb commented Jun 4, 2019

This occurs for Rx/Tx devices like LimeSDR, HackRF... with a Rx and Tx device set opened for the same device. Scenario is to start Tx stop it and leave Rx alone all the time. Then shutting down the application (ctl-q).

Dump occurs because an attempt is made to remove an item from an empty vector:

#7  0x00007f3fc35af78e in DeviceAPI::removeSinkBuddy (this=0x55bf7c52ea80, buddy=0x7f3fac0013f0) at /opt/build/sdrangel/sdrbase/device/deviceapi.cpp:728
728	            m_sourceBuddies.erase(it);
(gdb) p m_sourceBuddies
$1 = std::vector of length 0, capacity 0

Full stack trace:

#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:371
371	../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
[Current thread is 1 (Thread 0x7f3fc4547c80 (LWP 29285))]
(gdb) bt
#0  0x00007f3fc1505c40 in __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:371
#1  0x00007f3fc35b1a33 in std::__copy_move<true, true, std::random_access_iterator_tag>::__copy_m<DeviceAPI*>(DeviceAPI* const*, DeviceAPI* const*, DeviceAPI**) (__first=0x55bf7d3a8968, __last=0x0, __result=0x55bf7d3a8960)
    at /usr/include/c++/7/bits/stl_algobase.h:368
#2  0x00007f3fc35b199f in std::__copy_move_a<true, DeviceAPI**, DeviceAPI**>(DeviceAPI**, DeviceAPI**, DeviceAPI**) (__first=0x55bf7d3a8968, __last=0x0, __result=0x55bf7d3a8960) at /usr/include/c++/7/bits/stl_algobase.h:386
#3  0x00007f3fc35b179d in std::__copy_move_a2<true, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > > >(__gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >) (__first=0x0, __last=non-dereferenceable iterator for std::vector, __result=0x7f3fac0013f0) at /usr/include/c++/7/bits/stl_algobase.h:422
#4  0x00007f3fc35b155d in std::move<__gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > > >(__gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >, __gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >) (__first=0x0, __last=non-dereferenceable iterator for std::vector, __result=0x7f3fac0013f0) at /usr/include/c++/7/bits/stl_algobase.h:488
#5  0x00007f3fc35b0e27 in std::vector<DeviceAPI*, std::allocator<DeviceAPI*> >::_M_erase(__gnu_cxx::__normal_iterator<DeviceAPI**, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >) (this=0x55bf7c52eae8, __position=0x7f3fac0013f0)
    at /usr/include/c++/7/bits/vector.tcc:157
#6  0x00007f3fc35b03ff in std::vector<DeviceAPI*, std::allocator<DeviceAPI*> >::erase(__gnu_cxx::__normal_iterator<DeviceAPI* const*, std::vector<DeviceAPI*, std::allocator<DeviceAPI*> > >) (this=0x55bf7c52eae8, __position=0x7f3fac0013f0) at /usr/include/c++/7/bits/stl_vector.h:1180
#7  0x00007f3fc35af78e in DeviceAPI::removeSinkBuddy(DeviceAPI*) (this=0x55bf7c52ea80, buddy=0x7f3fac0013f0) at /opt/build/sdrangel/sdrbase/device/deviceapi.cpp:728
#8  0x00007f3fc35afa7f in DeviceAPI::clearBuddiesLists() (this=0x7f3fac0013f0) at /opt/build/sdrangel/sdrbase/device/deviceapi.cpp:754
#9  0x00007f3fc3fd29b7 in MainWindow::removeLastDevice() (this=0x7fff19a81f30) at /opt/build/sdrangel/sdrgui/mainwindow.cpp:552
#10 0x00007f3fc3fda86d in MainWindow::on_action_Exit_triggered() (this=0x7fff19a81f30) at /opt/build/sdrangel/sdrgui/mainwindow.cpp:1941
#11 0x00007f3fc40abe94 in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x7fff19a81f30, _c=QMetaObject::InvokeMetaMethod, _id=35, _a=0x7fff19a816a0)
    at /opt/build/sdrangel/build.debug/sdrgui/sdrgui_autogen/EWIEGA46WW/moc_mainwindow.cpp:259
#12 0x00007f3fc40abfd4 in MainWindow::qt_metacall(QMetaObject::Call, int, void**) (this=0x7fff19a81f30, _c=QMetaObject::InvokeMetaMethod, _id=35, _a=0x7fff19a816a0)
    at /opt/build/sdrangel/build.debug/sdrgui/sdrgui_autogen/EWIEGA46WW/moc_mainwindow.cpp:293
#13 0x00007f3fc1fc2679 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f3fc2d0b122 in QAction::triggered(bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f3fc2d0d80c in QAction::activate(QAction::ActionEvent) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f3fc2d0e0d5 in QAction::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007f3fc2d1182c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007f3fc2d190f4 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007f3fc1f939a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007f3fc25833b7 in QShortcutMap::dispatchEvent(QKeyEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#21 0x00007f3fc258348a in QShortcutMap::tryShortcut(QKeyEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#22 0x00007f3fc2531c63 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#23 0x00007f3fc2551f97 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#24 0x00007f3fc2556fd5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007f3fc252e2eb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007f3fb769e1c0 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#27 0x00007f3fbdabe417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f3fbdabe650 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f3fbdabe6dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f3fc1fec8ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#31 0x00007f3fc1f919ea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007f3fc1f9aa84 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x000055bf7a4fadc8 in runQtApplication(int, char**, qtwebapp::LoggerWithFile*) (argc=3, argv=0x7fff19a822e8, logger=0x55bf7b8308a0) at /opt/build/sdrangel/app/main.cpp:134
#34 0x000055bf7a4fb035 in main(int, char**) (argc=3, argv=0x7fff19a822e8) at /opt/build/sdrangel/app/main.cpp:141

Offending part of the code sdrbase/device/deviceapi.cpp starting line 719:

    for (;it != m_sinkBuddies.end(); ++it)
    {
        if (*it == buddy)
        {
            qDebug("DeviceAPI::removeSinkBuddy: buddy %s(%s) [%llu] removed from the list of [%llu]",
                    qPrintable(buddy->getHardwareId()),
                    qPrintable(buddy->getSamplingDeviceSerial()),
                    (quint64) (*it),
                    (quint64) this);
            m_sourceBuddies.erase(it);
            return;
        }
    }

Edit: also occurs if you have been using the Rx part.

@f4exb f4exb added the bug label Jun 4, 2019
@f4exb
Copy link
Owner Author

f4exb commented Jun 4, 2019

Looks like a copy+paste error.

@f4exb
Copy link
Owner Author

f4exb commented Jun 4, 2019

So line 728 has to be replaced with: m_sinkBuddies.erase(it);

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

1 participant