guglielmo icon indicating copy to clipboard operation
guglielmo copied to clipboard

working on FM, crashing on DAB

Open bassman56 opened this issue 3 years ago • 16 comments

Hi! today I compiled gugliemo and try to get it working with a RTL-SDR.COM stick (RTL2832U + RT820T2)

FM works with sound! DAB crashes ONLY on channels with signal. It segfaults with: (gdb) bt #0 0x00007ffff5fcb69e in __memmove_avx_unaligned_erms () from /lib64/libc.so.6 #1 0x00000000004248cb in dabProcessor::run() () #2 0x00007ffff6461e61 in ?? () from /lib64/libQt5Core.so.5 #3 0x00007ffff5ecb427 in start_thread () from /lib64/libc.so.6 #4 0x00007ffff5f54810 in clone3 () from /lib64/libc.so.6 (gdb)

Any advice of what todo? Thank you! - Christian

bassman56 avatar Dec 30 '21 17:12 bassman56

I just read your issue and have compiled it for the first time (Ubuntu 20.04), but here it works as promised (with audio on DAB).

grafik grafik grafik

./apps/guglielmo/build/guglielmo
OK, functions seem to be loaded
Found Rafael Micro R820T/2 tuner
samplerate set to 2048000
Supported gain values (29): 49,6 48,0 44,5 43,9 43,4 42,1 40,2 38,6 37,2 36,4 33,8 32,8 29,7 28,0 25,4 22,9 20,7 19,7 16,6 15,7 14,4 12,5 8,7 7,7 3,7 2,7 1,4 0,9 0,0 
gain will be set 50 to 254
Allocating 15 zero-copy buffers
channel reset: all services will be stopped
starting a backend for Radio 1 DAB      (9442)
stopping (sub)service at subchannel 7
starting a backend for Radio Antena     (940B)
stopping (sub)service at subchannel 9
starting a backend for Slo 1 Prvi       (9201)

What does the console output say in your case? BTW: I've installed all required packages for Qt-DAB as well.

andimik avatar Dec 30 '21 22:12 andimik

thank you! this is what my console is saying(when crashing): I am just selecting "DAB" and 5C channel on the GUI (default is FM) ./guglielmo we could not load libmirsdrapi-rsp If that is not the device you were expecting, do not worry OK, functions seem to be loaded Found Rafael Micro R820T tuner [R82XX] PLL not locked! samplerate set to 2048000 Supported gain values (29): 49,6 48,0 44,5 43,9 43,4 42,1 40,2 38,6 37,2 36,4 33,8 32,8 29,7 28,0 25,4 22,9 20,7 19,7 16,6 15,7 14,4 12,5 8,7 7,7 3,7 2,7 1,4 0,9 0,0 failed to open libairspy.so Error = libairspy.so: cannot open shared object file: No such file or directory failed to open libLimeSuite.so failed to open libhackrf.so gain will be set 50 to 254 Allocating 15 zero-copy buffers pilot 36,729710 usePilot 1 pll drift avg 0,537946% mean 1,499735% pilot 0 Allocating 15 zero-copy buffers channel reset: all services will be stopped Allocating 15 zero-copy buffers channel reset: all services will be stopped Segmentation fault (Speicherabzug geschrieben)

BTW: I am working on opensuse Tumbleweed. for the cmake I had to add 1 line in FindQwt.cmake to find the qwt headers: /usr/include/qt5/qwt6 since the qwt seems to be located sligghtly different in thumbleweed.

Nevertheless the seg fault seems to happen in dabProcessor::run(), so I thought the graphical interface not to be the suspect here? Any advice what I can try?

bassman56 avatar Dec 31 '21 11:12 bassman56

PS I proceeded a bit. creating a debug build with "cmake -DCMAKE_BUILD_TYPE=Debug .." Now the stack trace is telling a bit more:

Thread 26 "dabProcessor" received signal SIGSEGV, Segmentation fault.** [Switching to Thread 0x7fffe2e9d640 (LWP 745)] 0x00007ffff5fcb69e in __memmove_avx_unaligned_erms () from /lib64/libc.so.6 Missing separate debuginfos, .. (gdb) where #0 0x00007ffff5fcb69e in _memmove_avx_unaligned_erms () from /lib64/libc.so.6 #1 0x00000000004496e9 in mscHandler::process_Msc (this=0x226ec90, b=0x10284df30, blkno=2) at /home/mahr/Nextcloud/software/SDR-RTL/gugliemo/guglielmo/src/backend/msc-handler.cpp:107 #2 0x00000000004278e3 in dabProcessor::run (this=0x226a2b0) at /home/mahr/Nextcloud/software/SDR-RTL/gugliemo/guglielmo/src/dab/dab-processor.cpp:295 #3 0x00007ffff6461e61 in ?? () from /lib64/libQt5Core.so.5 #4 0x00007ffff5ecb427 in start_thread () from /lib64/libc.so.6 #5 0x00007ffff5f54810 in clone3 () from /lib64/libc.so.6 (gdb)

So the memcpy() in /msc-handler.cpp:107 seems to copy to an invalid address? this mscHandler::process is called from dab/dab-processor.cpp:295

Any Idea for next step (I am not very good at using gdb)? Thanks! christan

bassman56 avatar Dec 31 '21 14:12 bassman56

Sorry - completely missed this. To be fair, the msc-handler is not something I had a look at, but I build on OpenSuse leap 15.2 and Ubuntu 20.04 and I have never seen it. Let me have a look.

marcogrecopriolo avatar Feb 22 '22 16:02 marcogrecopriolo

I have pushed a defensive fix, could you try? BTW, you should have the same issue with Qt-dab

marcogrecopriolo avatar Feb 22 '22 16:02 marcogrecopriolo

@bassman56 could you pull and try?

marcogrecopriolo avatar Feb 23 '22 08:02 marcogrecopriolo

I seem to have almost the opposite of this bug, DAB works fine, but FM does not play. No error or crash, no suspicious logging, pilot is found, RDS shows on the info card, all looks fine. Just no sound.

MightyPork avatar Feb 25 '22 15:02 MightyPork

@bassman56 any joy?

marcogrecopriolo avatar Mar 13 '22 09:03 marcogrecopriolo

.. , RDS shows on the info card, all looks fine. Just no sound.

Same here on Windows-10.

gvanem avatar Mar 28 '22 06:03 gvanem

@ marcogrecopriolo Sorry for my late answer. I just tried a completely new compile on Tumbleweed. Note that I still have to add 1 line in FindQwt.cmake to find the qwt headers: /usr/include/qt5/qwt6 (location for header files in tumbleweed) Compiles well with a lot of warnings. Now when I run on DAB: I can hear music/sound! Thank you! Changing the channels within one DAB carrier also works!

Still another problem. When I change the DAB carrier with the channel selector (when just pressing the button) I get a segfault! need to check for more details... Christian

bassman56 avatar Mar 28 '22 13:03 bassman56

@bassman56 could the segfaults you see be what I reported in #10?

MightyPork avatar Mar 28 '22 13:03 MightyPork

no, seems different. See stacktrace Thread 1 "guglielmo" received signal SIGSEGV, Segmentation fault. QHash<QModelIndex, QPersistentModelIndexData*>::findNode (h=1950983423, akey=..., this=0x1e5f9a0) at ../../include/QtCore/../../src/corelib/tools/qhash.h:931 Downloading 0.04 MB source file /usr/src/debug/libqt5-qtbase-5.15.2+kde294-4.1.x86_64/src/widgets/../../include/QtCore/../../src/corelib/tools/qhash.h 931 while (*node != e && !(*node)->same_key(h, akey))
Missing separate debuginfos, use: zypper install Mesa-dri-debuginfo-21.3.7-303.1.x86_64 Mesa-libGL1-debuginfo-21.3.7-303.1.x86_64 Mesa-libglapi0-debuginfo-21.3.7-303.1.x86_64 breeze5-style-debuginfo-5.24.2-1.1.x86_64 kimageformats-debuginfo-5.91.0-1.1.x86_64 kio-core-debuginfo-5.91.0-1.1.x86_64 kio-debuginfo-5.91.0-1.1.x86_64 kservice-debuginfo-5.91.0-1.1.x86_64 kwayland-debuginfo-5.91.0-1.1.x86_64 libKF5Archive5-debuginfo-5.91.0-1.1.x86_64 libKF5AuthCore5-debuginfo-5.91.0-1.1.x86_64 libKF5Bookmarks5-debuginfo-5.91.0-1.1.x86_64 libKF5Codecs5-debuginfo-5.91.0-1.1.x86_64 libKF5Completion5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigCore5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigGui5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigWidgets5-debuginfo-5.91.0-1.1.x86_64 libKF5CoreAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5Crash5-debuginfo-5.91.0-1.1.x86_64 libKF5DBusAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5GlobalAccel5-debuginfo-5.91.0-1.1.x86_64 libKF5GuiAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5I18n5-debuginfo-5.91.0-1.1.x86_64 libKF5IconThemes5-debuginfo-5.91.0-1.1.x86_64 libKF5ItemViews5-debuginfo-5.91.0-1.1.x86_64 libKF5JobWidgets5-debuginfo-5.91.0-1.1.x86_64 libKF5Notifications5-debuginfo-5.91.0-1.1.x86_64 libKF5Solid5-debuginfo-5.91.0-1.1.x86_64 libKF5Style5-debuginfo-5.91.0-1.1.x86_64 libKF5WidgetsAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5WindowSystem5-debuginfo-5.91.0-1.1.x86_64 libLLVM13-debuginfo-13.0.1-3.1.x86_64 libblkid1-debuginfo-2.37.3-1.2.x86_64 libdbus-1-3-debuginfo-1.12.22-1.1.x86_64 libfaad2-debuginfo-2.10.0-1.28.x86_64 libgcc_s1-debuginfo-11.2.1+git1173-2.3.x86_64 libglib-2_0-0-debuginfo-2.70.4-1.2.x86_64 libharfbuzz0-debuginfo-4.0.0-1.1.x86_64 libjack0-debuginfo-1.9.19-1.3.x86_64 libmount1-debuginfo-2.37.3-1.2.x86_64 libopenssl1_1-debuginfo-1.1.1m-3.3.x86_64 libstdc++6-debuginfo-11.2.1+git1173-2.3.x86_64 libsystemd0-debuginfo-249.10-2.1.x86_64 libudev1-debuginfo-249.10-2.1.x86_64 libuuid1-debuginfo-2.37.3-1.2.x86_64 plasma5-integration-plugin-debuginfo-5.24.2-1.1.x86_64 (gdb)

bassman56 avatar Mar 28 '22 14:03 bassman56

another segfault when changing DAB channels: Thread 1 "guglielmo" received signal SIGSEGV, Segmentation fault. QHash<QModelIndex, QPersistentModelIndexData*>::findNode (h=1172551434, akey=..., this=0x1e5fb80) at ../../include/QtCore/../../src/corelib/tools/qhash.h:931 931 while (*node != e && !(*node)->same_key(h, akey)) Missing separate debuginfos, use: zypper install Mesa-dri-debuginfo-21.3.7-303.1.x86_64 Mesa-libGL1-debuginfo-21.3.7-303.1.x86_64 Mesa-libglapi0-debuginfo-21.3.7-303.1.x86_64 breeze5-style-debuginfo-5.24.2-1.1.x86_64 kimageformats-debuginfo-5.91.0-1.1.x86_64 kio-core-debuginfo-5.91.0-1.1.x86_64 kio-debuginfo-5.91.0-1.1.x86_64 kservice-debuginfo-5.91.0-1.1.x86_64 kwayland-debuginfo-5.91.0-1.1.x86_64 libKF5Archive5-debuginfo-5.91.0-1.1.x86_64 libKF5AuthCore5-debuginfo-5.91.0-1.1.x86_64 libKF5Bookmarks5-debuginfo-5.91.0-1.1.x86_64 libKF5Codecs5-debuginfo-5.91.0-1.1.x86_64 libKF5Completion5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigCore5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigGui5-debuginfo-5.91.0-1.1.x86_64 libKF5ConfigWidgets5-debuginfo-5.91.0-1.1.x86_64 libKF5CoreAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5Crash5-debuginfo-5.91.0-1.1.x86_64 libKF5DBusAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5GlobalAccel5-debuginfo-5.91.0-1.1.x86_64 libKF5GuiAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5I18n5-debuginfo-5.91.0-1.1.x86_64 libKF5IconThemes5-debuginfo-5.91.0-1.1.x86_64 libKF5ItemViews5-debuginfo-5.91.0-1.1.x86_64 libKF5JobWidgets5-debuginfo-5.91.0-1.1.x86_64 libKF5Notifications5-debuginfo-5.91.0-1.1.x86_64 libKF5Solid5-debuginfo-5.91.0-1.1.x86_64 libKF5Style5-debuginfo-5.91.0-1.1.x86_64 libKF5WidgetsAddons5-debuginfo-5.91.0-1.1.x86_64 libKF5WindowSystem5-debuginfo-5.91.0-1.1.x86_64 libLLVM13-debuginfo-13.0.1-3.1.x86_64 libblkid1-debuginfo-2.37.3-1.2.x86_64 libdbus-1-3-debuginfo-1.12.22-1.1.x86_64 libfaad2-debuginfo-2.10.0-1.28.x86_64 libgcc_s1-debuginfo-11.2.1+git1173-2.3.x86_64 libglib-2_0-0-debuginfo-2.70.4-1.2.x86_64 libharfbuzz0-debuginfo-4.0.0-1.1.x86_64 libjack0-debuginfo-1.9.19-1.3.x86_64 libmount1-debuginfo-2.37.3-1.2.x86_64 libopenssl1_1-debuginfo-1.1.1m-3.3.x86_64 libstdc++6-debuginfo-11.2.1+git1173-2.3.x86_64 libsystemd0-debuginfo-249.10-2.1.x86_64 libudev1-debuginfo-249.10-2.1.x86_64 libuuid1-debuginfo-2.37.3-1.2.x86_64 plasma5-integration-plugin-debuginfo-5.24.2-1.1.x86_64 (gdb) Killed

Interestingly, the debug-compiled version seems to be more robust than the non-debug.

Note that in addition, a string "Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt." appears VERY OFTEN on the terminal when music is playing on DAB.

bassman56 avatar Mar 29 '22 12:03 bassman56

sorry I forgot the stack trace last time. here another example

Thread 1 "guglielmo" received signal SIGSEGV, Segmentation fault. QHash<QModelIndex, QPersistentModelIndexData*>::findNode (h=312146652, akey=..., this=0x1e5f170) at ../../include/QtCore/../../src/corelib/tools/qhash.h:931 931 while (node != e && !(node)->same_key(h, akey)) (gdb) bt #0 QHash<QModelIndex, QPersistentModelIndexData>::findNode (h=312146652, akey=..., this=0x1e5f170) at ../../include/QtCore/../../src/corelib/tools/qhash.h:931 #1 QHash<QModelIndex, QPersistentModelIndexData>::findNode (ahp=0x0, akey=..., this=0x1e5f170) at ../../include/QtCore/../../src/corelib/tools/qhash.h:950 #2 QHash<QModelIndex, QPersistentModelIndexData*>::contains (akey=..., this=0x1e5f170) at ../../include/QtCore/../../src/corelib/tools/qhash.h:920 #3 QAbstractItemViewPrivate::isPersistent (index=..., this=0x1e5fbe0) at ../../include/QtWidgets/5.15.2/QtWidgets/private/../../../../../src/widgets/itemviews/qabstractitemview_p.h:350 #4 QListViewPrivate::isHidden (this=this@entry=0x1e5fbe0, row=) at ../../include/QtWidgets/5.15.2/QtWidgets/private/../../../../../src/widgets/itemviews/qlistview_p.h:395 #5 0x00007ffff7cf71a8 in QListViewPrivate::hasRectForIndex (index=..., index=..., this=0x1e5fbe0) at ../../include/QtWidgets/5.15.2/QtWidgets/private/../../../../../src/widgets/itemviews/qlistview_p.h:336 #6 QListViewPrivate::hasRectForIndex (index=..., this=0x1e5fbe0) at ../../include/QtWidgets/5.15.2/QtWidgets/private/../../../../../src/widgets/itemviews/qlistview_p.h:336 #7 QListViewPrivate::rectForIndex (index=..., this=0x1e5fbe0) at ../../include/QtWidgets/5.15.2/QtWidgets/private/../../../../../src/widgets/itemviews/qlistview_p.h:343 #8 QListView::rectForIndex (this=, index=...) at itemviews/qlistview.cpp:1303 #9 0x00007ffff7cf729e in QListView::visualRect (this=, index=...) at itemviews/qlistview.cpp:561 #10 0x00007ffff7b51466 in QComboBox::showPopup (this=0x1e5ede0) at widgets/qcombobox.cpp:2796 #11 0x00007ffff7b51f3e in QComboBoxPrivate::showPopupFromMouseEvent (this=0x1e5ee20, e=) at widgets/qcombobox.cpp:3288 #12 0x00007ffff7a868de in QWidget::event (this=0x1e5ede0, event=0x7fffffffd2d0) at kernel/qwidget.cpp:9020 #13 0x00007ffff7a44a7f in QApplicationPrivate::notify_helper (this=this@entry=0x1d42ef0, receiver=receiver@entry=0x1e5ede0, e=e@entry=0x7fffffffd2d0) at kernel/qapplication.cpp:3632 #14 0x00007ffff7a4c584 in QApplication::notify (this=, receiver=0x1e5ede0, e=0x7fffffffd2d0) at kernel/qapplication.cpp:3076 #15 0x00007ffff6641e3a in QCoreApplication::notifyInternal2 (receiver=0x1e5ede0, event=0x7fffffffd2d0) at kernel/qcoreapplication.cpp:1064 #16 0x00007ffff7a4b093 in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x1e5ede0, event=event@entry=0x7fffffffd2d0, alienWidget=alienWidget@entry=0x1e5ede0, nativeWidget=0x1e58e20, buttonDown=, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2614 #17 0x00007ffff7a9f9dc in QWidgetWindow::handleMouseEvent (this=0x1ef4a30, event=0x7fffffffd5a0) at kernel/qwidgetwindow.cpp:683 #18 0x00007ffff7aa2df5 in QWidgetWindow::event (this=0x1ef4a30, event=0x7fffffffd5a0) at kernel/qwidgetwindow.cpp:300 #19 0x00007ffff7a44a7f in QApplicationPrivate::notify_helper (this=, receiver=0x1ef4a30, e=0x7fffffffd5a0) at kernel/qapplication.cpp:3632 #20 0x00007ffff6641e3a in QCoreApplication::notifyInternal2 (receiver=0x1ef4a30, event=0x7fffffffd5a0) at kernel/qcoreapplication.cpp:1064 #21 0x00007ffff6c54627 in QGuiApplicationPrivate::processMouseEvent (e=0x7fffa400c4d0) at kernel/qguiapplication.cpp:2282 #22 0x00007ffff6c2a85c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169 #23 0x00007ffff24ebe0a in xcbSourceDispatch (source=) at qxcbeventdispatcher.cpp:105 #24 0x00007ffff4c0ee22 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #25 0x00007ffff4c0f1b8 in ?? () from /lib64/libglib-2.0.so.0 #26 0x00007ffff4c0f26f in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #27 0x00007ffff6699384 in QEventDispatcherGlib::processEvents (this=0x1e2caf0, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #28 0x00007ffff664083b in QEventLoop::exec (this=this@entry=0x7fffffffd8d0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #29 0x00007ffff6648b10 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #30 0x0000000000425516 in main (argc=1, argv=0x7fffffffdb38) at /home/mahr/Nextcloud/software/SDR-RTL/gugliemo/guglielmo/src/main.cpp:123 (gdb)

bassman56 avatar Mar 29 '22 12:03 bassman56

From what I can tell, this is a Qt bug - I have tried to repro on a qmake build, a cmake build and the appimage, but I can open the channel combobox at will without issues, and I have done it several hundred times: my fingers ache for hitting the touchpad so much! Note that in the stack you are going straight from a mouse event to displaying the combo box, without even going through the RadioInterface code. I have found several matching issues in the Qt's jira.

At this stage the best thing I can suggest is downgrade to Qt 5.12.7, which is what I use on OpenSuse Leap 15.2? Also re the headers, I'll amend findQwt.cmake

marcogrecopriolo avatar Apr 05 '22 17:04 marcogrecopriolo

I have built two fresh vb images one opensuse leap 15.4 beta and one opensuse tumbleweed. Except for having to add a line to FindQwt.cmake (the qwt location has indeed changed since 15.2), I do not repro any segvs nor persistent messages with DAB playing, and I have tried both qmake and cmake builds and different log levels (which should be irrelevant anyway). I'll need a more detailed repro for this?

marcogrecopriolo avatar Apr 09 '22 11:04 marcogrecopriolo