Bug 475733 - Infinite loop in KWin::Placement::placeSmart() on new window
Summary: Infinite loop in KWin::Placement::placeSmart() on new window
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: generic-crash (other bugs)
Version First Reported In: 5.27.8
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-17 12:06 UTC by thaytan
Modified: 2024-10-26 03:47 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thaytan 2023-10-17 12:06:54 UTC
SUMMARY

Several times today, I've observed an infinite loop in KWin::Placement::placeSmart() when opening a new application.

That leads to kwin_wayland becoming unresponsive until killed, in a 100% CPU loop. I think this is the same root issue as bug #407221, but since that was closed I thought better to file a new bug.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 38 with KDE 5.27.8

When it gets stuck, `KWin::Placement::placeSmart` is spinning in the overall do/while loop:
`do { ... } while ((overlap != none) && (overlap != h_wrong) && (y < area.bottom()));`

When it reaches the condition at the end of the loop, `y=1234` and area = `{xp = 0, yp = 0, w = 2194.2857142857142, h = 1234.2857142857142}`

With the mismatch between integer y and fractional screen height, I think the root cause is fractional scaling (I have a small 4k display and 175% scaling.

Backtrace:
(gdb) bt
#0  KWin::Placement::placeSmart(KWin::Window*, QRectF const&, KWin::PlacementPolicy) (this=<optimized out>, area=..., window=<optimized out>) at /usr/src/debug/kwin-5.27.8-1.fc38.x86_64/src/placement.cpp:201
#1  KWin::Placement::placeSmart(KWin::Window*, QRectF const&, KWin::PlacementPolicy) (this=<optimized out>, window=<optimized out>, area=...) at /usr/src/debug/kwin-5.27.8-1.fc38.x86_64/src/placement.cpp:159
#2  0x00007f10dd566e0e in KWin::X11Window::manage(unsigned int, bool) (this=0x5633e2e12eb0, w=<optimized out>, isMapped=false) at /usr/src/debug/kwin-5.27.8-1.fc38.x86_64/src/x11window.cpp:757
#3  0x00007f10dd546068 in KWin::Workspace::createX11Window(unsigned int, bool) (this=0x5633e154d140, windowId=12582920, is_mapped=false) at /usr/src/debug/kwin-5.27.8-1.fc38.x86_64/src/workspace.cpp:711
#4  0x00007f10dd44c455 in KWin::Workspace::workspaceEvent(xcb_generic_event_t*) (this=0x5633e154d140, e=0x5633e1bc0120) at /usr/src/debug/kwin-5.27.8-1.fc38.x86_64/src/events.cpp:215
#5  0x00007f10dbab123c in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () at /lib64/libQt5Core.so.5
#6  0x00005633e0a4c0d9 in KWin::Xwl::Xwayland::dispatchEvents(KWin::Xwl::Xwayland::DispatchEventsMode) ()
#7  0x00007f10dbae8481 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt5Core.so.5
#8  0x00007f10dbaeae8d in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () at /lib64/libQt5Core.so.5
#9  0x00007f10dbaeb6fb in QSocketNotifier::event(QEvent*) () at /lib64/libQt5Core.so.5
#10 0x00007f10db1aeb75 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#11 0x00007f10dbab41a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#12 0x00007f10dbb037ff in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () at /lib64/libQt5Core.so.5
#13 0x00007f10dbb03b80 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#14 0x00005633e0b199c2 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#15 0x00007f10dbab2b6b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#16 0x00007f10dbabadfb in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#17 0x00005633e0a32e44 in main ()
Comment 1 Zamundaaa 2024-09-26 12:57:38 UTC
Does this still happen for you in Plasma 6?
Comment 2 Bug Janitor Service 2024-10-11 03:49:24 UTC
๐Ÿ›๐Ÿงน โš ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2024-10-26 03:47:01 UTC
๐Ÿ›๐Ÿงน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.