Bug 464547 - krfb-virtualmonitor asserts on start
Summary: krfb-virtualmonitor asserts on start
Status: RESOLVED FIXED
Alias: None
Product: krfb
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 12:25 UTC by Nicolas Fella
Modified: 2024-03-12 23:43 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Fella 2023-01-20 12:25:08 UTC
When I tried using the virtual monitor feature in KDE Connect krfb-virtualmonitor crashes/asserts:

kdeconnect.plugin.virtualmonitor: virtual display finished with "dumbledore" "ASSERT: \"qimage.size() == streamSize\" in file /home/nico/kde/src/kpipewire/src/dmabufhandler.cpp, line 170\n"

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fb4486afec3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fb44865fa76 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fb4486497fc in __GI_abort () at abort.c:79
#4  0x00007fb448c98b75 in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1914
#5  QMessageLogger::fatal (this=this@entry=0x7ffe1db1c930, msg=msg@entry=0x7fb448f8b048 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:893
#6  0x00007fb448c97ff5 in qt_assert (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:3376
#7  0x00007fb42f7e9531 in DmaBufHandler::downloadFrame (this=0x1439680, qimage=..., frame=...) at /home/nico/kde/src/kpipewire/src/dmabufhandler.cpp:170
#8  0x00007fb42c503291 in PWFrameBuffer::Private::handleFrame (this=0x1439610, frame=...) at /home/nico/kde/src/krfb/framebuffers/pipewire/pw_framebuffer.cpp:398
#9  0x00007fb42c500900 in operator() (__closure=0x143a490, frame=...) at /home/nico/kde/src/krfb/framebuffers/pipewire/pw_framebuffer.cpp:156
#10 0x00007fb42c50440a in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<const PipeWireFrame&>, void, PWFrameBuffer::Private::Private(PWFrameBuffer*)::<lambda(const PipeWireFrame&)> >::call(struct {...} &, void **) (f=..., arg=0x7ffe1db1cd00) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:146
#11 0x00007fb42c504389 in QtPrivate::Functor<PWFrameBuffer::Private::Private(PWFrameBuffer*)::<lambda(const PipeWireFrame&)>, 1>::call<QtPrivate::List<PipeWireFrame const&>, void>(struct {...} &, void *, void **) (f=..., arg=0x7ffe1db1cd00) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:256
#12 0x00007fb42c504234 in QtPrivate::QFunctorSlotObject<PWFrameBuffer::Private::Private(PWFrameBuffer*)::<lambda(const PipeWireFrame&)>, 1, QtPrivate::List<const PipeWireFrame&>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x143a480, r=0x141e840, a=0x7ffe1db1cd00, ret=0x0) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:443
#13 0x00007fb448ee7ab2 in QtPrivate::QSlotObjectBase::call (a=0x7ffe1db1cd00, r=0x141e840, this=0x143a480) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#14 doActivate<false> (sender=0x1439900, signal_index=7, argv=0x7ffe1db1cd00) at kernel/qobject.cpp:3923
#15 0x00007fb42c28fa55 in PipeWireSourceStream::frameReceived (this=0x1439900, _t1=...) at /home/nico/kde/build/kpipewire/src/KPipeWire_autogen/EWIEGA46WW/moc_pipewiresourcestream.cpp:204
#16 0x00007fb42c29e30b in PipeWireSourceStream::handleFrame (this=0x1439900, buffer=0x151a560) at /home/nico/kde/src/kpipewire/src/pipewiresourcestream.cpp:534
#17 0x00007fb42c29e4e4 in PipeWireSourceStream::process (this=0x1439900) at /home/nico/kde/src/kpipewire/src/pipewiresourcestream.cpp:552
#18 0x00007fb42c29c7dd in onProcess (data=0x1439900) at /home/nico/kde/src/kpipewire/src/pipewiresourcestream.cpp:318
#19 0x00007fb42c32fde8 in do_call_process (loop=<optimized out>, async=<optimized out>, seq=<optimized out>, data=<optimized out>, size=<optimized out>, user_data=0x151a160) at ../src/pipewire/stream.c:435
#20 0x00007fb42c26b63f in flush_items (impl=0x14f68c8) at ../spa/plugins/support/loop.c:191
#21 0x00007fb42c26a8ed in source_event_func (source=0x1323b00) at ../spa/plugins/support/loop.c:615
#22 0x00007fb42c26c187 in loop_iterate (object=<optimized out>, timeout=<optimized out>) at ../spa/plugins/support/loop.c:452
#23 0x00007fb42c290185 in operator() (__closure=0x1487110) at /home/nico/kde/src/kpipewire/src/pipewirecore.cpp:78
#24 0x00007fb42c290dc6 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, PipeWireCore::init(int)::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7ffe1db1d630)
    at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:146
#25 0x00007fb42c290da7 in QtPrivate::Functor<PipeWireCore::init(int)::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7ffe1db1d630)
    at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:256
#26 0x00007fb42c290d76 in QtPrivate::QFunctorSlotObject<PipeWireCore::init(int)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, 
    this_=0x1487100, r=0x7fb430014950, a=0x7ffe1db1d630, ret=0x0) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:443
#27 0x00007fb448ee7ab2 in QtPrivate::QSlotObjectBase::call (a=0x7ffe1db1d630, r=0x7fb430014950, this=0x1487100) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#28 doActivate<false> (sender=0x14f1d70, signal_index=3, argv=0x7ffe1db1d630) at kernel/qobject.cpp:3923
#29 0x00007fb448ee130f in QMetaObject::activate (sender=sender@entry=0x14f1d70, m=m@entry=0x7fb449189180 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, 
    argv=argv@entry=0x7ffe1db1d630) at kernel/qobject.cpp:3983
#30 0x00007fb448eeae7f in QSocketNotifier::activated (this=this@entry=0x14f1d70, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#31 0x00007fb448eeb565 in QSocketNotifier::event (this=0x14f1d70, e=<optimized out>) at kernel/qsocketnotifier.cpp:302
#32 0x00007fb449d7c3ae in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x14f1d70, e=0x7ffe1db1d720) at kernel/qapplication.cpp:3640
#33 0x00007fb448eb2838 in QCoreApplication::notifyInternal2 (receiver=0x14f1d70, event=0x7ffe1db1d720) at kernel/qcoreapplication.cpp:1064
#34 0x00007fb448f0790d in socketNotifierSourceDispatch (source=0x1354690) at kernel/qeventdispatcher_glib.cpp:107
#35 0x00007fb445b16cbf in g_main_dispatch (context=0x7fb430005010) at ../glib/gmain.c:3444
#36 g_main_context_dispatch (context=0x7fb430005010) at ../glib/gmain.c:4162
#37 0x00007fb445b6c598 in g_main_context_iterate.constprop.0 (context=0x7fb430005010, block=1, dispatch=1, self=<optimized out>) at ../glib/gmain.c:4238
#38 0x00007fb445b13f40 in g_main_context_iteration (context=0x7fb430005010, may_block=1) at ../glib/gmain.c:4303

krfb/plasma from master
Comment 1 Aleix Pol 2023-01-20 17:53:21 UTC
If you run it from the terminal such as:
krfb-virtualmonitor --name "banana" --resolution 1200x400 --password 1111 --port 5900

Do you also have this problem?

Would you be able to add a
qDebug() << "I'm going to crash!" << qimage.size() << streamSize;

Right before the exploding line and tell us the result?
Comment 2 Jordan Pryde 2024-03-12 23:43:16 UTC
(Manually making this comment since I didn't have a bug tracker account until now - I got an email that this failed)
Fixed by https://invent.kde.org/network/krfb/-/merge_requests/63 in master

@bug_id = 482929
@bug_status = RESOLVED
@resolution = FIXED
@cf_commitlink = https://invent.kde.org/network/krfb/-/commit/966ad6a1639732f882284ff6e708b0e37e624ca7

Git commit 966ad6a1639732f882284ff6e708b0e37e624ca7 by Jordan Pryde.
Committed on 12/03/2024 at 16:11.
Pushed by nicolasfella into branch 'release/24.02'.

DMA-BUF size may not match size from handleRemoteDesktopStarted()

QScreen::size() marshalled from xdg-desktop-portal-kde uses logical
scaled size but the DMA-BUF from pipewire is the physical pixel count.
We now check the DMA-BUF size each frame and resize the QImage buffer when
needed.
Related: bug 478057, bug 464547

M  +1    -0    framebuffers/pipewire/pw_framebuffer.cpp

https://invent.kde.org/network/krfb/-/commit/966ad6a1639732f882284ff6e708b0e37e624ca7