Wayland / Xorg compositor segfault #192
Comments
Definitely
200ms seems quite high. Does the script still work okay with that delay?
Running it twice per frame is probably too much anyway.
That was a workaround for uncomposited KWin. It's probably outdated now and can be removed. So 1,3 and 4 can go in, number 2 seems dubious. Personally I feel KWin Wayland is still not ready yet, so I'm not using it. That means I won't really notice if anything's broken on wayland. I have noticed KWin being more crashy in general after a recent upgrade tho. |
It seems fine. There is a 0.2s delay in places. Even this isn't high enough really. Some window still flicker 3 or 4 times before they appear. Konsole seems to be the worst culprit for some reason. I also only noticed this after a recent update, it was fine for months. I'll try lowering the value to see where the cut off point is. I had hoped that 1 frame would be enough, but it's not. I wonder if an animation or something takes 0.2s which affects the way the script sees the geometry.
The upstream fix to kwin meant that |
I think I have some additional information but need to do further tests: I was getting random segfaults when opening new windows. I changed After making the change, I also haven't had the weird flicker effect so when using Is there a way the scripting engine can detect whether we're on Wayland or X? Because the |
The only one I know of is that |
I don't think that this is an issue specific to Wayland, unfortunately. I'm reasonably confident I'm having the same issue under X. The patch does help mitigate it somewhat, but it's not perfect. I figure this is probably an upstream issue, but I wanted to add some additional information here as well in-case it helps anyone more familiar with the innards of kwin and kwin-tiling; I'm able to reliably reproduce this since about Christmas (currently on plasma 5.18, KDE 5.67, qt 5.14.1 and still see it) by constantly resizing a window - usually this triggers it within a few seconds.. obviously wouldn't normally be doing this. However I see it in general use by also;
The creeping effect is a separate issue that I need to tie down further. The rest I realise is probably just apps interacting with each other in unfun ways triggering the kwin crash |
I was also trying to track this down and have had the problem in X since I posted this. My patch fixes dragging but sometimes when addClient is called it causes the same crash. I wasn't able to work out the cause. |
I also have these more or less random crashes since v5.17.90. I do not, however, think it's something we should try to fix in the script. KWin should never crash due to the script engine activity. |
While I agree, in the interest of having a stable desktop I've been trying to workaround it. I just had the crash twice in 10 minutes on X. It's really frustrating to the point where I've just turned off the compositor entirely. There's a bug report for KDE here: https://bugs.kde.org/show_bug.cgi?id=415872 If anyone can get a backtrace of the issue it'd be really useful if you can post it there. Unfortunately running Arch makes this difficult and I've been unable to replicate the problem using Neon in virtualbox. |
My backtrace usually looks like:
So the bug in fact seems to be in Qt5's QV4::MemoryManager implementation. |
Edit 3: Never mind. The patch has already been released with v5.14.1 :( |
Where we've seen this before it has not been a QML bug. It means QML is referencing an object that's been unexpectedly destroyed before processing the destruction. This could mean some JS code calld some code that deleted an object then returned back to JS space all within the same "event". It's frustrating that the backtrace is seemingly cut off. |
Hi @davidedmundson, it's nice to have you here. I had much more useful backtrace from debug versions of KWin and qt5-declarative, but could not make any sense out of it either. I suspect KWin from destroying objects or triggering events concurrently on a "wrong" thread. Don't have a proof though. |
It should be all on one thread, but there's still multiple concepts "space" when it comes to QML. Ultimately I'm somewhat stuck on fixing with the current information. I can try and install the extension and hope to randomly reproduce it (any tips for reproducing would help). If you can find a way to recreate in a more minimal example that would also help. |
Once you have the script installed and enabled, it's very easy to trigger - just open two windows on the same screen, grab one of the adjacent window frames and keep resizing. This usually crashes KWin in just a few seconds. Electron windows are more likely to trigger the bug than others for some reason. |
@davidedmundson did you manage to replicate the issue? If not, I'll try to provide a VM that lets you reoproduce the issue easily. edit: I cannot get this to happen in KDE Neon in virtualbox however hard I try. Does Neon (ubuntu) run an older version of QML that isn't affected? At first I thought it was because virtualbox defaulted to 1 core, but giving it 12 cores still didn't make the issue appear. I will note that I cannot get Neon to run higher than 800x600 in virtualbox. I've no idea why but it refuses to let me set a higher resolution. Unfortunately that leaves a lot of variables:
|
it looks like this may be fixed in Qt 5.15 ( https://bugreports.qt.io/browse/QTBUG-84363 ). Once it's available in the arch stable repository I'll let you know but I'm hopeful! |
Would explain why I couldn't reproduce |
Nope. Crashes all the same with Qt 5.15.0. |
QV4_FORCE_INTERPRETER=1 seems to have worked for me too. Are there any downsides to setting this variable? |
Yes, it's much slower. |
Where can I apply |
See the bottom of this page: https://community.kde.org/KWin/Environment_Variables I'll note that I've been running this for a month now and "much slower" is probably like 1ms vs 10ms because I haven't noticed any differences in speed on the desktop at all. |
Not sure if this is helpful in fixing the underlying issue, but with I mention it because I never noticed this without the fix and I wonder if this is the same issue as the crash only with different symptoms with/without |
This seems to work now, and it breaks Wayland. See #192.
The annoying thing here is:
So I added them in 9f7cd08. |
Okay, if I'm seeing this correctly there's nothing left to do here that I want to add, it's all upstream work. |
I've found the cause of the #191 and implemented a workaround:
TRPB@f69bdfc
For some reason, running
this.movingEnded.emit();
more than once per frame causes the segfault.Do you want me to send a PR for these wayland workarounds to master?
My complete wayland changelog:
krunner and screeen locker window classes to ignored.js (This should probably be in master)
Changed the geometry timer in main.qml to 200ms. Any lower and some wayland windows get a
strange infinite loop where they keep being resized between their tile size and original size. I had thought that this would be a similar once per frame issue but any lower than about ~80 causes it to happen often. And ~100 causes it to happen infrequently.
The workaround above
Removed the compositor check in tilelist.js clientAdded: TRPB@1fd493b Without this, Wayland windows are not tracked by the script.
The text was updated successfully, but these errors were encountered: