Summary: | kwin_wayland segmentation faulted in KWin::LibInput::Context::closeRestricted when logging out of Plasma with libinput-1.18.901-1.fc35 | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Matt Fagnani <matt.fagnani> |
Component: | libinput | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | bednarczyk.pawel, nate, xaver.hugl |
Priority: | NOR | ||
Version: | 5.22.5 | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=443088 | ||
Latest Commit: | https://invent.kde.org/plasma/kwin/commit/d18f89b52f499a30527011020a74733c004f0814 | Version Fixed In: | 5.23 |
Description
Matt Fagnani
2021-09-07 01:43:15 UTC
Still happens with git master, too. The reason is that teardown of input depends on the platform, which is deleted before input. Not sure how to best solve it yet, parenting the InputIntegration object to the platform instead of the application causes a different segfault, AFACT due to some annoying details about how C++ destructors work. (In reply to Zamundaaa from comment #1) > Still happens with git master, too. The reason is that teardown of input > depends on the platform, which is deleted before input. > > Not sure how to best solve it yet, parenting the InputIntegration object to > the platform instead of the application causes a different segfault, AFACT > due to some annoying details about how C++ destructors work. I've seen this kwin_wayland crash happen about 10/15 times when logging out of Plasma using a mouse and 3/6 using a touchpad. The crash also happened with libinput-1.19.0-1.fc35. The problem might involve a race condition where the file descriptor fd had been closed or memory associated with the platform had been freed sometimes before being used by KWin::LibInput::Context::closeRestricted while Plasma was logging out. Thanks. (In reply to Zamundaaa from comment #1) > Still happens with git master, too. The reason is that teardown of input > depends on the platform, which is deleted before input. > > Not sure how to best solve it yet, parenting the InputIntegration object to > the platform instead of the application causes a different segfault, AFACT > due to some annoying details about how C++ destructors work. to make things even more worse, libinput does some threading stuff... i'd tried to fix this crash, but due to the lack of any design (singleton is absolutely inappropriate here), it's really hard to do. :( *** Bug 442911 has been marked as a duplicate of this bug. *** A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1464 Can somebody please test whether !1464 fixes the issue? I'm unable to reproduce it. I recompiled kwin with this patch but can only test tomorrow. I will get back to you guys tomorrow. Tried a few logouts, seems to work seems to work for me as well, I couldn't reproduce the crash anymore Git commit 7900068cab6e34e0517439c17438ad544ceb602f by Vlad Zahorodnii. Committed on 28/09/2021 at 14:37. Pushed by vladz into branch 'master'. wayland: Destroy InputRedirection explicitly M +5 -0 src/main.cpp M +1 -0 src/main.h M +1 -0 src/main_wayland.cpp https://invent.kde.org/plasma/kwin/commit/7900068cab6e34e0517439c17438ad544ceb602f Git commit d7d1c6600ab9c95fb852a66d2a8fb745caa5d716 by Vlad Zahorodnii. Committed on 28/09/2021 at 14:37. Pushed by vladz into branch 'master'. wayland: Move ownership of the libinput thread to InputRedirection When libinput tears down, it may access the Session object. This change re-jitters the shut down logic so the Session object is guaranteed to be valid when libinput stuff gets destroyed. M +16 -0 src/input.cpp M +1 -0 src/input.h M +1 -18 src/libinput/connection.cpp M +0 -3 src/libinput/connection.h https://invent.kde.org/plasma/kwin/commit/d7d1c6600ab9c95fb852a66d2a8fb745caa5d716 The fix has been pushed to git master only. It will be back ported to 5.23 after more testing (the main reason: the fix changes some threading code). A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1469 Git commit 6513c66ca6edb7d7bffcaec173eb1c12d2242aac by Vlad Zahorodnii. Committed on 28/09/2021 at 17:29. Pushed by vladz into branch 'master'. wayland: Move ConnectionAdaptor to the same thread as Connection Connection deletes the ConnectionAdaptor, but they are in different threads, which is weird. M +4 -6 src/libinput/connection.cpp https://invent.kde.org/plasma/kwin/commit/6513c66ca6edb7d7bffcaec173eb1c12d2242aac With all those commits, I'm still getting a Libinput-related crash on logout, but it's a different one. See Bug 443088. Git commit 7dc1f92c5a26d46df685a5d08b848a5457770b5a by Vlad Zahorodnii. Committed on 01/10/2021 at 08:25. Pushed by vladz into branch 'Plasma/5.23'. wayland: Destroy InputRedirection explicitly (cherry picked from commit 7900068cab6e34e0517439c17438ad544ceb602f) M +5 -0 src/main.cpp M +1 -0 src/main.h M +1 -0 src/main_wayland.cpp https://invent.kde.org/plasma/kwin/commit/7dc1f92c5a26d46df685a5d08b848a5457770b5a Git commit d18f89b52f499a30527011020a74733c004f0814 by Vlad Zahorodnii. Committed on 01/10/2021 at 08:25. Pushed by vladz into branch 'Plasma/5.23'. wayland: Move ownership of the libinput thread to InputRedirection When libinput tears down, it may access the Session object. This change re-jitters the shut down logic so the Session object is guaranteed to be valid when libinput stuff gets destroyed. (cherry picked from commit d7d1c6600ab9c95fb852a66d2a8fb745caa5d716) M +16 -0 src/input.cpp M +1 -0 src/input.h M +1 -18 src/libinput/connection.cpp M +0 -3 src/libinput/connection.h https://invent.kde.org/plasma/kwin/commit/d18f89b52f499a30527011020a74733c004f0814 Git commit 14090a249d65ac83df4058ebb06cb6d185be65ca by Vlad Zahorodnii. Committed on 01/10/2021 at 08:25. Pushed by vladz into branch 'Plasma/5.23'. wayland: Move ConnectionAdaptor to the same thread as Connection Connection deletes the ConnectionAdaptor, but they are in different threads, which is weird. (cherry picked from commit 6513c66ca6edb7d7bffcaec173eb1c12d2242aac) M +4 -6 src/libinput/connection.cpp https://invent.kde.org/plasma/kwin/commit/14090a249d65ac83df4058ebb06cb6d185be65ca |