Bug 501229 - krdpserver segfaults when trying to connect
Summary: krdpserver segfaults when trying to connect
Status: CONFIRMED
Alias: None
Product: KRdp
Classification: Plasma
Component: general (show other bugs)
Version: 6.3.2
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-08 15:38 UTC by jan.claussen10
Modified: 2025-03-12 19:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
coredump (41.49 KB, text/plain)
2025-03-08 15:38 UTC, jan.claussen10
Details
Debug symbols (a lot optimized out) (177.27 KB, text/plain)
2025-03-08 17:34 UTC, jan.claussen10
Details
attachment-3758001-0.html (2.78 KB, text/html)
2025-03-08 18:21 UTC, jan.claussen10
Details
attachment-3764450-0.html (823 bytes, text/html)
2025-03-08 18:28 UTC, jan.claussen10
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jan.claussen10 2025-03-08 15:38:18 UTC
Created attachment 179227 [details]
coredump

SUMMARY
The server is crashing upon connection. No idea why.

STEPS TO REPRODUCE
1. krdpserver --port 3389 

OBSERVED RESULT
org.kde.krdp: Listening for connections on QHostAddress(QHostAddress::Any) 3389
org.kde.krdp: Initializing Freedesktop Portal Session
org.kde.krdp: Could not open a new remote desktop session, error code 4294967295
KCrash: Application 'krdpserver' crashing... crashRecursionCounter = 2
[1]    6584 segmentation fault (core dumped)  krdpserver --port 3389

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Arch
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
Comment 1 Harald Sitter 2025-03-08 16:34:51 UTC
If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
Comment 2 jan.claussen10 2025-03-08 16:36:16 UTC
Isn't the coredump enough?
Comment 3 Harald Sitter 2025-03-08 16:41:51 UTC
No, it lacks debug symbols.
Comment 4 jan.claussen10 2025-03-08 17:34:55 UTC
Created attachment 179230 [details]
Debug symbols (a lot optimized out)

Really hard to get the full debug symbols. I installed all the -debug packages for krdp and its dependencies, but there is still a lot missing. Even tried recompiling it with -O0 -g, but to no avail.
Comment 5 Harald Sitter 2025-03-08 17:53:40 UTC
Looks alright. The crash looks like a symptom of something else going wrong though. Specifically we get a dbus error and then crash because of that. Do you maybe have more relevant output in your journal from xdg-desktop-portal-kde or kwin?

At a glance I'd say the crash happens because we have a direct call chain into uninitialized members. That should be an easy fix by guarding d->peer in RdpConnection and/or doing a queued invocation somewhere. 

#0  0x00007ffff7e8992c in KRdp::RdpConnection::close (this=0x5555555ae780, reason=KRdp::RdpConnection::CloseReason::None) at /home/jan/.cache/yay/krdp-git/src/krdp/src/RdpConnection.cpp:219
#1  0x0000555555561cfe in operator() (__closure=0x5555559a5140) at /home/jan/.cache/yay/krdp-git/src/krdp/server/SessionController.cpp:155
#2  0x000055555556312f in operator() (__closure=0x7fffffffbcc0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:141
#3  0x00005555555631fd in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SessionController::onNewConnection(KRdp::RdpConnection*)::<lambda()> >::call(SessionController::onNewConnection(KRdp::RdpConnection*)::<lambda()>&, void**)::<lambda()> >(void **, struct {...} &&) (args=0x7fffffffbdf8, fn=...) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65
#4  0x0000555555563174 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SessionController::onNewConnection(KRdp::RdpConnection*)::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7fffffffbdf8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:140
#5  0x0000555555563009 in QtPrivate::FunctorCallable<SessionController::onNewConnection(KRdp::RdpConnection*)::<lambda()> >::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffbdf8) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:362
#6  0x0000555555562f59 in QtPrivate::QCallableObject<SessionController::onNewConnection(KRdp::RdpConnection*)::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x5555559a5130, r=0x7fffffffd640, a=0x7fffffffbdf8, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:572
        that = 0x5555559a5130
#7  0x00007ffff5bb1a49 in QtPrivate::QSlotObjectBase::call (this=0x5555559a5130, r=0x7fffffffd640, a=0x7fffffffbdf8, this=<optimized out>, r=<optimized out>, a=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:486
#8  doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4115
        obj = {m_slotObject = std::unique_ptr<QtPrivate::QSlotObjectBase> = {get() = 0x5555559a5130}}
        receiver = 0x7fffffffd640
        td = <optimized out>
        receiverInSameThread = <optimized out>
        senderData = {previous = 0x7fffffffca90, receiver = 0x7fffffffd640, sender = 0x7fffd8010680, signal = 3}
        c = 0x55555599ffb0
        connections = {d = <optimized out>}
        list = <optimized out>
        inSenderThread = <optimized out>
        highestConnectionId = <optimized out>
        signalVector = 0x5555559c11c0
        currentThreadId = <optimized out>
        sp = <optimized out>
        signal_spy_set = 0x0
        empty_argv = {0x0}
        senderDeleted = false
#9  0x000055555556247b in SessionWrapper::sessionError (this=0x7fffd8010680) at /home/jan/.cache/yay/krdp-git/src/krdp/build/server/krdpserver_autogen/include/SessionController.moc:167
#10 0x000055555556869a in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (SessionWrapper::*)()>::call(void (SessionWrapper::*)(), SessionWrapper*, void**)::{lambda()#1}::operator()() const (__closure=0x7fffffffbed0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:152
#11 0x0000555555568f52 in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (SessionWrapper::*)()>::call(void (SessionWrapper::*)(), SessionWrapper*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (SessionWrapper::*)()>::call(void (SessionWrapper::*)(), SessionWrapper*, void**)::{lambda()#1}&&) (args=0x7fffffffc008, fn=...) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65
#12 0x000055555556870c in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (SessionWrapper::*)()>::call(void (SessionWrapper::*)(), SessionWrapper*, void**) (f=(void (SessionWrapper::*)(SessionWrapper * const)) 0x555555562452 <SessionWrapper::sessionError()>, o=0x7fffd8010680, arg=0x7fffffffc008) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:151
#13 0x0000555555567d98 in QtPrivate::FunctionPointer<void (SessionWrapper::*)()>::call<QtPrivate::List<>, void>(void (SessionWrapper::*)(), SessionWrapper*, void**) (f=(void (SessionWrapper::*)(SessionWrapper * const)) 0x555555562452 <SessionWrapper::sessionError()>, o=0x7fffd8010680, arg=0x7fffffffc008) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:199
#14 0x0000555555567199 in QtPrivate::QCallableObject<void (SessionWrapper::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x5555559a3800, r=0x7fffd8010680, a=0x7fffffffc008, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:570
        that = 0x5555559a3800
#15 0x00007ffff5bb1a49 in QtPrivate::QSlotObjectBase::call (this=0x5555559a3800, r=0x7fffd8010680, a=0x7fffffffc008, this=<optimized out>, r=<optimized out>, a=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:486
#16 doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4115
        obj = {m_slotObject = std::unique_ptr<QtPrivate::QSlotObjectBase> = {get() = 0x5555559a3800}}
        receiver = 0x7fffd8010680
        td = <optimized out>
        receiverInSameThread = <optimized out>
        senderData = {previous = 0x0, receiver = 0x7fffd8010680, sender = 0x5555559bc140, signal = 4}
        c = 0x55555599c830
        connections = {d = <optimized out>}
        list = <optimized out>
        inSenderThread = <optimized out>
        highestConnectionId = <optimized out>
        signalVector = 0x7fffd8001c10
        currentThreadId = <optimized out>
        sp = <optimized out>
        signal_spy_set = 0x0
        empty_argv = {0x0}
        senderDeleted = false
#17 0x00007ffff7e71f71 in KRdp::AbstractSession::error (this=0x5555559bc140) at /home/jan/.cache/yay/krdp-git/src/krdp/build/src/KRdp_autogen/EWIEGA46WW/moc_AbstractSession.cpp:191
#18 0x00007ffff7ea1a68 in KRdp::PortalSession::onCreateSession (this=0x5555559bc140, code=4294967295, result=...) at /home/jan/.cache/yay/krdp-git/src/krdp/src/PortalSession.cpp:186
        PermissionsPersistUntilExplicitlyRevoked = 2
        parameters = {d = {d = 0x12a}}
        restorationGroup = {<KConfigBase> = {_vptr.KConfigBase = 0x7fffffffc170}, d = {d = 0x7fffffffc1b0}}
        restoreToken = {d = {d = 0x7fffffffc170, ptr = 0x7fffffffc1b0 u"抠翿", size = 140737488339368}, static _empty = 0 u'\000'}
#19 0x00007ffff7eb39b5 in std::__invoke_impl<void, void (KRdp::PortalSession::*&)(unsigned int, QMap<QString, QVariant> const&), KRdp::PortalSession*&, unsigned int, QMap<QString, QVariant> const&> (__f=@0x55555599d050: (void (KRdp::PortalSession::*)(KRdp::PortalSession * const, unsigned int, const QMap<QString, QVariant> &)) 0x7ffff7ea194a <KRdp::PortalSession::onCreateSession(unsigned int, QMap<QString, QVariant> const&)>, __t=@0x55555599d060: 0x5555559bc140) at /usr/include/c++/14.2.1/bits/invoke.h:74
#20 0x00007ffff7eb2b5b in std::__invoke<void (KRdp::PortalSession::*&)(unsigned int, QMap<QString, QVariant> const&), KRdp::PortalSession*&, unsigned int, QMap<QString, QVariant> const&> (__fn=@0x55555599d050: (void (KRdp::PortalSession::*)(KRdp::PortalSession * const, unsigned int, const QMap<QString, QVariant> &)) 0x7ffff7ea194a <KRdp::PortalSession::onCreateSession(unsigned int, QMap<QString, QVariant> const&)>) at /usr/include/c++/14.2.1/bits/invoke.h:96
#21 0x00007ffff7eb20c5 in std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>::__call<void, unsigned int&&, QMap<QString, QVariant> const&, 0ul, 1ul, 2ul>(std::tuple<unsigned int&&, QMap<QString, QVariant> const&>&&, std::_Index_tuple<0ul, 1ul, 2ul>) (this=0x55555599d050, __args=...) at /usr/include/c++/14.2.1/functional:513
#22 0x00007ffff7eb1407 in std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>::operator()<unsigned int, QMap<QString, QVariant> const&, void>(unsigned int&&, QMap<QString, QVariant> const&) (this=0x55555599d050) at /usr/include/c++/14.2.1/functional:598
#23 0x00007ffff7eb0303 in std::__invoke_impl<void, std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>&, unsigned int, QMap<QString, QVariant> const&>(std::__invoke_other, std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>&, unsigned int&&, QMap<QString, QVariant> const&) (__f=...) at /usr/include/c++/14.2.1/bits/invoke.h:61
#24 0x00007ffff7eaf06f in std::__invoke_r<void, std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>&, unsigned int, QMap<QString, QVariant> const&>(std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)>&, unsigned int&&, QMap<QString, QVariant> const&) (__fn=...) at /usr/include/c++/14.2.1/bits/invoke.h:111
#25 0x00007ffff7ead3b2 in std::_Function_handler<void (unsigned int, QMap<QString, QVariant> const&), std::_Bind<void (KRdp::PortalSession::*(KRdp::PortalSession*, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, QMap<QString, QVariant> const&)> >::_M_invoke(std::_Any_data const&, unsigned int&&, QMap<QString, QVariant> const&) (__functor=..., __args#0=@0x7fffffffc514: 4294967295, __args#1=...) at /usr/include/c++/14.2.1/bits/std_function.h:290
#26 0x00007ffff7ea7d36 in std::function<void(unsigned int, QMap<QString, QVariant> const&)>::operator() (this=0x555555975160, __args#0=4294967295, __args#1=...) at /usr/include/c++/14.2.1/bits/std_function.h:591
#27 0x00007ffff7ea065a in KRdp::PortalRequest::onStarted (this=0x555555975140, watcher=0x55555599d000) at /home/jan/.cache/yay/krdp-git/src/krdp/src/PortalSession.cpp:57
        reply = {<QDBusPendingReplyBase> = {<QDBusPendingCall> = {d = {d = 0x5555558b1440}}, <No data fields>}, <No data fields>}
Comment 6 jan.claussen10 2025-03-08 17:56:17 UTC
I do actually. The token thing looks like it

Mär 08 16:24:57 precision5810 kwin_wayland[1716]: kwin_screencast: PipeWire remote error:  connection error
Mär 08 16:51:02 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:03:18 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:04:38 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:04:54 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:05:09 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:05:14 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:05:33 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a6fabe0)
Mär 08 17:42:43 precision5810 kwin_wayland[1716]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Mär 08 17:42:44 precision5810 kwin_wayland[1716]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Mär 08 17:43:01 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a7bdcc0)
Mär 08 18:33:14 precision5810 kwin_wayland[1716]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x5dab6a7bdcc0)
Comment 7 Harald Sitter 2025-03-08 18:05:37 UTC
The plot thickens. Couple of thoughts:

a) is pipewire running and working?
b) is there something special about your setup? do you have a source build or something of plasmashell/xdg-desktop-portal-kde/kwin? the "Cannot grant a token to" specifically suggests that your plasmashell is getting rejected from talking to kwin, which usually means kwin cannot find plasma's desktop file in /usr/share/applications.
Comment 8 jan.claussen10 2025-03-08 18:21:17 UTC
Created attachment 179231 [details]
attachment-3758001-0.html

Not sure. I do run Arch, but everything KDE should be from the official repos.

Pipewire is running.
❯ systemctl --user status pipewire
● pipewire.service - PipeWire Multimedia Service
Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; preset: enabled)
Active: active (running) since Sat 2025-03-08 19:16:53 CET; 3min 16s ago
Invocation: 73f8e5fee38b47aebd6a8d96e0efd994
TriggeredBy: ● pipewire.socket
Main PID: 49942 (pipewire)
Tasks: 4 (limit: 76623)
Memory: 6M (peak: 6.8M)
CPU: 58ms
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
└─49942 /usr/bin/pipewire

Mär 08 19:16:53 precision5810 systemd[1558]: Started PipeWire Multimedia Service.
Mär 08 19:16:53 precision5810 pipewire[49942]: pw.context: vm.overrides in context.properties are deprecated, use context.properties.rules instead

Not sure about the XDG stuff, but the desktop files are there.
❯ ls /usr/share/applications/ | grep plasma
kcm_plasmasearch.desktop
org.kde.kdeconnect.nonplasma.desktop
org.kde.plasma-fallback-session-save.desktop
org.kde.plasma-systemmonitor.desktop
org.kde.plasma-welcome.desktop
org.kde.plasma.browser_integration.host.desktop
org.kde.plasma.emojier.desktop
org.kde.plasma.settings.open.desktop
org.kde.plasma.themeexplorer.desktop
org.kde.plasmaengineexplorer.desktop
org.kde.plasmashell.desktop
org.kde.plasmawindowed.desktop

On März 8 2025, at 7:05 pm, Harald Sitter <bugzilla_noreply@kde.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=501229
>
> --- Comment #7 from Harald Sitter <sitter@kde.org> ---
> The plot thickens. Couple of thoughts:
>
> a) is pipewire running and working?
> b) is there something special about your setup? do you have a source build or
> something of plasmashell/xdg-desktop-portal-kde/kwin? the "Cannot grant a token
> to" specifically suggests that your plasmashell is getting rejected from
> talking to kwin, which usually means kwin cannot find plasma's desktop file in
> /usr/share/applications.
>
> --
> You are receiving this mail because:
> You reported the bug.
>
Comment 9 Harald Sitter 2025-03-08 18:27:25 UTC
Oh well, let's deal with the crash and see where that gets us.
Comment 10 jan.claussen10 2025-03-08 18:28:55 UTC
Created attachment 179232 [details]
attachment-3764450-0.html

Alright, if I can look up more stuff for you, let me know!

On März 8 2025, at 7:27 pm, Harald Sitter <bugzilla_noreply@kde.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=501229
>
> Harald Sitter <sitter@kde.org> changed:
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEEDSINFO |CONFIRMED
> Resolution|WAITINGFORINFO |---
> Ever confirmed|0 |1
>
> --- Comment #9 from Harald Sitter <sitter@kde.org> ---
> Oh well, let's deal with the crash and see where that gets us.
>
> --
> You are receiving this mail because:
> You reported the bug.
>