Bug 426899 - kstars segmentation fault in doActivate when starting
Summary: kstars segmentation fault in doActivate when starting
Status: RESOLVED FIXED
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: 3.4.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Jasem Mutlaq
URL: https://bugzilla.redhat.com/show_bug....
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-23 11:14 UTC by Matt Fagnani
Modified: 2022-10-13 03:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Fagnani 2020-09-23 11:14:24 UTC
SUMMARY

I installed kstars-3.4.3-3.fc33.x86_64 in a Fedora 33 KDE Plasma spin installation running Plasma 5.19.5 on Wayland. kstars segmentation faulted in doActivate or QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator-> at kernel/qobject.cpp:3766 in qt5-qtbase-5.15.1-1.fc33.x86_64 when starting each of a few times.

Core was generated by `/usr/bin/kstars'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fcf10ad4e5b in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->
    (this=<optimized out>) at kernel/qobject.cpp:3766
3766    void doActivate(QObject *sender, int signal_index, void **argv)
(gdb) bt
#0  0x00007fcf10ad4e5b in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->
    (this=<optimized out>) at kernel/qobject.cpp:3766
#1  qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > (ptr=...)
    at ../../include/QtCore/../../src/corelib/global/qglobal.h:1135
#2  QObject::d_func (this=<optimized out>) at kernel/qobject.h:132
#3  QObjectPrivate::get (o=<optimized out>) at kernel/qobject_p.h:339
#4  doActivate<false> (sender=0x0, signal_index=9, argv=0x7ffc77021ce0) at kernel/qobject.cpp:3768
#5  0x00007fcf10f08ee2 in QGuiApplication::screenAdded (this=<optimized out>, _t1=<optimized out>)
    at .moc/moc_qguiapplication.cpp:389
#6  0x00007fcefe390698 in QtWaylandClient::QWaylandDisplay::handleScreenInitialized (this=
    0x5581ed409b60, screen=<optimized out>) at qwaylanddisplay.cpp:281
#7  0x00007fcefe39d623 in QtWaylandClient::QWaylandScreen::maybeInitialize (this=0x5581ed401a20)
    at qwaylandscreen.cpp:97
#8  QtWaylandClient::QWaylandScreen::maybeInitialize (this=0x5581ed401a20) at qwaylandscreen.cpp:86
#9  0x00007fcefe26bb10 in ffi_call_unix64 () at ../src/x86/unix64.S:76
#10 0x00007fcefe26b0a3 in ffi_call (cif=cif@entry=0x7ffc77021e80, fn=<optimized out>, 
    rvalue=<optimized out>, rvalue@entry=0x0, avalue=avalue@entry=0x7ffc77021f50)
    at ../src/x86/ffi64.c:525
#11 0x00007fcefe3138fe in wl_closure_invoke (closure=closure@entry=0x5581ed414590, 
    target=<optimized out>, target@entry=0x5581ed4126b0, opcode=opcode@entry=2, data=<optimized out>, 
    flags=<optimized out>) at src/connection.c:1018
#12 0x00007fcefe313fcb in dispatch_event (display=display@entry=0x5581ed409d10, 
    queue=<optimized out>, queue=<optimized out>) at src/wayland-client.c:1445
#13 0x00007fcefe31419c in dispatch_queue (queue=0x5581ed409de0, display=0x5581ed409d10)
    at src/wayland-client.c:1591
--Type <RET> for more, q to quit, c to continue without paging--c
#14 wl_display_dispatch_queue_pending (display=0x5581ed409d10, queue=0x5581ed409de0) at src/wayland-client.c:1833
#15 0x00007fcefe390d85 in QtWaylandClient::QWaylandDisplay::forceRoundTrip (this=this@entry=0x5581ed409b60) at qwaylanddisplay.cpp:476
#16 0x00007fcefe398514 in QtWaylandClient::QWaylandDisplay::registry_global (this=0x5581ed409b60, id=21, interface=..., version=2) at qwaylanddisplay.cpp:351
#17 0x00007fcefe3ab88f in QtWayland::wl_registry::handle_global (data=0x5581ed409b70, object=<optimized out>, name=21, interface=0x5581ed4122d0 "zxdg_output_manager_v1", version=2) at /usr/include/qt5/QtCore/qstring.h:701
#18 0x00007fcefe26bb10 in ffi_call_unix64 () at ../src/x86/unix64.S:76
#19 0x00007fcefe26b0a3 in ffi_call (cif=cif@entry=0x7ffc77022320, fn=<optimized out>, rvalue=<optimized out>, rvalue@entry=0x0, avalue=avalue@entry=0x7ffc770223f0) at ../src/x86/ffi64.c:525
#20 0x00007fcefe3138fe in wl_closure_invoke (closure=closure@entry=0x5581ed4121f0, target=<optimized out>, target@entry=0x5581ed409e60, opcode=opcode@entry=0, data=<optimized out>, flags=<optimized out>) at src/connection.c:1018
#21 0x00007fcefe313fcb in dispatch_event (display=display@entry=0x5581ed409d10, queue=<optimized out>, queue=<optimized out>) at src/wayland-client.c:1445
#22 0x00007fcefe31419c in dispatch_queue (queue=0x5581ed409de0, display=0x5581ed409d10) at src/wayland-client.c:1591
#23 wl_display_dispatch_queue_pending (display=0x5581ed409d10, queue=0x5581ed409de0) at src/wayland-client.c:1833
#24 0x00007fcefe390d85 in QtWaylandClient::QWaylandDisplay::forceRoundTrip (this=this@entry=0x5581ed409b60) at qwaylanddisplay.cpp:476
#25 0x00007fcefe396c59 in QtWaylandClient::QWaylandDisplay::QWaylandDisplay (this=<optimized out>, waylandIntegration=<optimized out>, this=<optimized out>, waylandIntegration=<optimized out>) at qwaylanddisplay.cpp:162
#26 0x00007fcefe38d8eb in QtWaylandClient::QWaylandIntegration::QWaylandIntegration (this=<optimized out>, this=<optimized out>) at qwaylandintegration.cpp:115
#27 0x00007fcf12f0f3b7 in QtWaylandClient::QWaylandIntegrationPlugin::create (this=<optimized out>, system=..., paramList=...) at main.cpp:59
#28 0x00007fcf10f01f4b in QPlatformIntegrationFactory::create (platform=..., paramList=..., argc=@0x7ffc77022a5c: 1, argv=<optimized out>, platformPluginPath=...) at kernel/qplatformintegrationfactory.cpp:51
#29 0x00007fcf10f0c690 in init_platform (argv=<optimized out>, argc=@0x7ffc77022a5c: 1, platformThemeName=..., platformPluginPath=..., pluginNamesWithArguments=...) at kernel/qguiapplication.cpp:1223
#30 QGuiApplicationPrivate::createPlatformIntegration (this=0x5581ed3ff6a0) at kernel/qguiapplication.cpp:1474
#31 0x00007fcf10f0dca0 in QGuiApplicationPrivate::createEventDispatcher (this=<optimized out>) at kernel/qguiapplication.cpp:1491
#32 0x00007fcf10aacf86 in QCoreApplicationPrivate::init (this=<optimized out>) at kernel/qcoreapplication.cpp:852
#33 0x00007fcf10f105f4 in QGuiApplicationPrivate::init (this=0x5581ed3ff6a0) at kernel/qguiapplication.cpp:1520
#34 0x00007fcf114d1ef9 in QApplicationPrivate::init (this=0x5581ed3ff6a0) at kernel/qapplication.cpp:513
#35 0x00005581eb8f029e in main (argc=<optimized out>, argv=0x7ffc77022e18) at /usr/src/debug/kstars-3.4.3-3.fc33.x86_64/kstars/main.cpp:80

Running kstars on X in konsole with QT_QPA_PLATFORM=xcb kstars and running kstars in Plasma on X also crashed in doActivate. The problem isn't specific to Wayland.


STEPS TO REPRODUCE
1. Boot a Fedora 33 KDE Plasma spin installation fully updated to 2020-9-23 with plasma-workspace-wayland and its dependencies installed
2. Log in to Plasma 5.19.5 on Wayland from sddm
3. start konsole
4. sudo dnf install kstars
5. kstars (in konsole)

OBSERVED RESULT
kstars segmentation fault in doActivate when starting

EXPECTED RESULT
kstars would start normally

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Fedora 33
(available in About System)
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.1

ADDITIONAL INFORMATION
qt5-qtdatavis3d-5.14.2-3.fc33.x86_64 was installed as a dependency of kstars. The rest of Qt is 5.15.1 on my system, so a Qt versioning problem might be possible.
Comment 1 Matt Fagnani 2020-09-23 11:32:50 UTC
I ran valgrind --log-file=valgrind-kstars-1.txt kstars An invalid read at the address 0x8 and segmentation fault occurred in operator-> at qscopedpointer.h:118 in qt5-qtbase-5.15.1-1.fc33.x86_64.

==3954== Memcheck, a memory error detector
==3954== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3954== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==3954== Command: kstars
==3954== Parent PID: 2717
==3954== 
==3954== Invalid read of size 8
==3954==    at 0x6C1CE5B: operator-> (qscopedpointer.h:118)
==3954==    by 0x6C1CE5B: qGetPtrHelper<QScopedPointer<QObjectData> > (qglobal.h:1135)
==3954==    by 0x6C1CE5B: d_func (qobject.h:132)
==3954==    by 0x6C1CE5B: get (qobject_p.h:339)
==3954==    by 0x6C1CE5B: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3768)
==3954==    by 0x64B5EE1: QGuiApplication::screenAdded(QScreen*) (moc_qguiapplication.cpp:389)
==3954==    by 0x195CF697: QtWaylandClient::QWaylandDisplay::handleScreenInitialized(QtWaylandClient::QWaylandScreen*) (qwaylanddisplay.cpp:281)
==3954==    by 0x195DC622: QtWaylandClient::QWaylandScreen::maybeInitialize() (qwaylandscreen.cpp:97)
==3954==    by 0x485EB0F: ffi_call_unix64 (unix64.S:76)
==3954==    by 0x485E0A2: ffi_call (ffi64.c:525)
==3954==    by 0x1968F8FD: wl_closure_invoke.constprop.0 (connection.c:1018)
==3954==    by 0x1968FFCA: dispatch_event.isra.0 (wayland-client.c:1445)
==3954==    by 0x1969019B: UnknownInlinedFun (wayland-client.c:1591)
==3954==    by 0x1969019B: wl_display_dispatch_queue_pending (wayland-client.c:1833)
==3954==    by 0x195CFD84: QtWaylandClient::QWaylandDisplay::forceRoundTrip() (qwaylanddisplay.cpp:476)
==3954==    by 0x195D7513: QtWaylandClient::QWaylandDisplay::registry_global(unsigned int, QString const&, unsigned int) (qwaylanddisplay.cpp:351)
==3954==    by 0x195EA88E: QtWayland::wl_registry::handle_global(void*, wl_registry*, unsigned int, char const*, unsigned int) (qwayland-wayland.cpp:94)
==3954==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==3954== 
==3954== 
==3954== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==3954==  Access not within mapped region at address 0x8
==3954==    at 0x6C1CE5B: operator-> (qscopedpointer.h:118)
==3954==    by 0x6C1CE5B: qGetPtrHelper<QScopedPointer<QObjectData> > (qglobal.h:1135)
==3954==    by 0x6C1CE5B: d_func (qobject.h:132)
==3954==    by 0x6C1CE5B: get (qobject_p.h:339)
==3954==    by 0x6C1CE5B: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3768)
==3954==    by 0x64B5EE1: QGuiApplication::screenAdded(QScreen*) (moc_qguiapplication.cpp:389)
==3954==    by 0x195CF697: QtWaylandClient::QWaylandDisplay::handleScreenInitialized(QtWaylandClient::QWaylandScreen*) (qwaylanddisplay.cpp:281)
==3954==    by 0x195DC622: QtWaylandClient::QWaylandScreen::maybeInitialize() (qwaylandscreen.cpp:97)
==3954==    by 0x485EB0F: ffi_call_unix64 (unix64.S:76)
==3954==    by 0x485E0A2: ffi_call (ffi64.c:525)
==3954==    by 0x1968F8FD: wl_closure_invoke.constprop.0 (connection.c:1018)
==3954==    by 0x1968FFCA: dispatch_event.isra.0 (wayland-client.c:1445)
==3954==    by 0x1969019B: UnknownInlinedFun (wayland-client.c:1591)
==3954==    by 0x1969019B: wl_display_dispatch_queue_pending (wayland-client.c:1833)
==3954==    by 0x195CFD84: QtWaylandClient::QWaylandDisplay::forceRoundTrip() (qwaylanddisplay.cpp:476)
==3954==    by 0x195D7513: QtWaylandClient::QWaylandDisplay::registry_global(unsigned int, QString const&, unsigned int) (qwaylanddisplay.cpp:351)
==3954==    by 0x195EA88E: QtWayland::wl_registry::handle_global(void*, wl_registry*, unsigned int, char const*, unsigned int) (qwayland-wayland.cpp:94)
==3954==  If you believe this happened as a result of a stack
==3954==  overflow in your program's main thread (unlikely but
==3954==  possible), you can try to increase the size of the
==3954==  main thread stack using the --main-stacksize= flag.
==3954==  The main thread stack size used in this run was 8388608.
==3954== 
==3954== HEAP SUMMARY:
==3954==     in use at exit: 462,865 bytes in 8,031 blocks
==3954==   total heap usage: 9,700 allocs, 1,669 frees, 826,505 bytes allocated
==3954== 
==3954== LEAK SUMMARY:
==3954==    definitely lost: 0 bytes in 0 blocks
==3954==    indirectly lost: 0 bytes in 0 blocks
==3954==      possibly lost: 160 bytes in 2 blocks
==3954==    still reachable: 462,705 bytes in 8,029 blocks
==3954==         suppressed: 0 bytes in 0 blocks
==3954== Rerun with --leak-check=full to see details of leaked memory
==3954== 
==3954== For lists of detected and suppressed errors, rerun with: -s
==3954== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Comment 2 Jasem Mutlaq 2022-10-10 06:12:34 UTC
Please check against KStars 3.6.1 and report back.
Comment 3 Matt Fagnani 2022-10-13 03:43:29 UTC
(In reply to Jasem Mutlaq from comment #2)
> Please check against KStars 3.6.1 and report back.

This problem was related to compiling kstars and some other Qt programs with link-time optimization (LTO) enabled and was fixed as described at https://bugzilla.redhat.com/show_bug.cgi?id=1881915