Bug 362596 - shared clipboard between two pc's and phone cause plasma UI freeze and app to crash
Summary: shared clipboard between two pc's and phone cause plasma UI freeze and app to...
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-02 18:01 UTC by ghost53947
Modified: 2016-09-26 13:16 UTC (History)
3 users (show)

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


Attachments
Journalctl logs of pc A and pc B. (5.79 KB, text/plain)
2016-05-02 18:05 UTC, ghost53947
Details
Full details of system activity of kdeconnectd with this bug in force (109.64 KB, text/plain)
2016-09-02 12:43 UTC, know1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ghost53947 2016-05-02 18:01:42 UTC
After copying something to clipboard on PC A my plasmashell froze. I was unable to right click on the desktop or bring up  krunner with ALT + F2 to start an app, alt-tab still continued to work. All other programs still worked, firefox did not freeze nor konsole or hexchat that was open at the time. I could not copy and paste. I tried to stop and start plasmashell but it did not work, instead I was left with a blank desktop no panel showed up.  

The logs showed QXcbClipboard: SelectionRequest too old, and  QXcbClipboard::setMimeData: Cannot set X11 selection owner. 

On PC  B I noticed the lock screen froze as well, used loginctl to unlock it and the dekstop was also frozen. The android app crashed as well. 



Reproducible: Always

Steps to Reproduce:
1. Pair PC A to phone
2. Pair PC B to phone
3. Pair PC B to PC A
4. Copy text to clipboard.
5. wait and watch logs as they get filled with an error and plasma shell freezes 

Actual Results:  
Plasmashell and krunner freeze unable to open or be used. 

Expected Results:  
Plasmashell should not crash and krunner should still function 

On both pc's the log shows the same error at the same time, there is a 1 minute difference in hw clock between the two. so the logs should be treated as the same time frame because they are.
Comment 1 ghost53947 2016-05-02 18:05:04 UTC
Created attachment 98749 [details]
Journalctl logs of pc A and pc B.
Comment 2 ghost53947 2016-05-02 18:34:15 UTC
PC A and PC B , were connected with wired LAN, phone was on wifi.
Comment 3 know1 2016-07-08 21:17:05 UTC
This also happens with my Fedora boxes, it seems the clipboard is put into a race state between each other and the clipboards are repeatedly copied automatically, with data shown being sent via the network traffic. Plasma freezes and can only be restored by killing kdeconnect. When Android devices are used the clipboard can be observed repeatedly copying the last 2 entries and causing the same race condition.
Comment 4 know1 2016-07-15 07:36:43 UTC
Unchecked 'copy clipboard' in each of the kdeconnect settings of the pc should stop this issue? Although that's the most useful feature.
Comment 5 know1 2016-07-15 19:17:37 UTC
(In reply to ykmssg-n01 from comment #4)
> Unchecked 'copy clipboard' in each of the kdeconnect settings of the pc
> should stop this issue? Although that's the most useful feature.

Unchecking clipboard doesn't help......have noticed on android the clipboard is populated with 
'--' without quotes and the last entry
Comment 6 Roman Gilg 2016-08-04 13:05:38 UTC
I have the same problem. I also use two PCs and a mobile device in the same wlan.

GDB backtraces:
plasmashell: https://paste.kde.org/pvhbsdqqf
kdeconnectd: https://paste.kde.org/pasy90uqp
Comment 7 Albert Vaca Cintora 2016-08-25 17:28:20 UTC
It's fixed in 1.0.
Comment 8 Albert Vaca Cintora 2016-08-25 22:14:55 UTC
No, it's not :/
Comment 9 know1 2016-09-02 11:56:01 UTC
(In reply to ykmssg-n01 from comment #5)
> (In reply to ykmssg-n01 from comment #4)
> > Unchecked 'copy clipboard' in each of the kdeconnect settings of the pc
> > should stop this issue? Although that's the most useful feature.
> 
> Unchecking clipboard doesn't help......have noticed on android the clipboard
> is populated with 
> '--' without quotes and the last entry
 '--' That is keepass clearing the clipboard
Is that where the problem lies?
Comment 10 know1 2016-09-02 11:58:15 UTC
..second thoughts, it's nothing to do with keepass as it happens whenever an item is copied or even cut
Comment 11 know1 2016-09-02 12:05:22 UTC
The network activity goes crazy and sends/receives in equal quantity and is what I look for so I can kill the Process 1422 - kdeconnectd with systemmonitor
Comment 12 know1 2016-09-02 12:07:42 UTC
This is when it's running fine (shall post the process when it goes crazy next)

Process 1422 - kdeconnectd

Summary

The process kdeconnectd (with pid 1422) is using approximately 14.8 MB of memory.
It is using 13.2 MB privately, and a further 37.0 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 1639.0 KB. Adding that to the private usage, we get the above mentioned total memory footprint of 14.8 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings, plus the stack of its 3 threads. 
Private
more
9052 KB	[heap]
476 KB	/usr/lib64/libqca-qt5.so.2.1.1
312 KB	/usr/lib64/qt5/plugins/crypto/libqca-ossl.so
228 KB	/usr/lib64/libcrypto.so.1.0.2h
220 KB	/usr/lib64/libkdeconnectcore.so.0.9.0
Shared
more
3148 KB	/usr/lib64/libQt5Core.so.5.6.1
2896 KB	/usr/lib64/libQt5Gui.so.5.6.1
2012 KB	/usr/lib64/libQt5Widgets.so.5.6.1
1628 KB	/usr/lib64/libcrypto.so.1.0.2h
1432 KB	/usr/lib64/libc-2.23.so
Totals

Private	13508 KB	(= 1408 KB clean + 12100 KB dirty)
Shared	37936 KB	(= 37892 KB clean + 44 KB dirty)
Rss	51444 KB	(= Private + Shared)
Pss	15147 KB	(= Private + Shared/Number of Processes)
Swap	0 KB
Comment 13 know1 2016-09-02 12:26:19 UTC
Now going krazy (only seems to happen when I have keepass open)
Process 1392 - kdeconnectd

Summary

The process kdeconnectd (with pid 1392) is using approximately 11.8 MB of memory.
It is using 10.2 MB privately, and a further 35.3 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 1569.0 KB. Adding that to the private usage, we get the above mentioned total memory footprint of 11.8 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings, plus the stack of its 3 threads. 
Private
more
6088 KB	[heap]
500 KB	/usr/lib64/libqca-qt5.so.2.1.1
304 KB	/usr/lib64/qt5/plugins/crypto/libqca-ossl.so
236 KB	/usr/lib64/libkdeconnectcore.so.0.9.0
204 KB	/usr/lib64/libQt5Widgets.so.5.6.1
Shared
more
3324 KB	/usr/lib64/libQt5Core.so.5.6.1
2824 KB	/usr/lib64/libQt5Gui.so.5.6.1
2008 KB	/usr/lib64/libQt5Widgets.so.5.6.1
1548 KB	/usr/lib64/libc-2.23.so
1544 KB	/usr/lib64/libcrypto.so.1.0.2h
Totals

Private	10472 KB	(= 1500 KB clean + 8972 KB dirty)
Shared	36096 KB	(= 36096 KB clean + 0 KB dirty)
Rss	46568 KB	(= Private + Shared)
Pss	12041 KB	(= Private + Shared/Number of Processes)
Swap	0 KB
Comment 14 know1 2016-09-02 12:43:29 UTC
Created attachment 100896 [details]
Full details of system activity of kdeconnectd with this bug in force

Was unable to paste from clipboard the full details while network was connected, as soon as disconnect from interwebs the clipboard pasted.
Comment 15 Albert Vaca Cintora 2016-09-09 14:19:48 UTC
Git commit c19f26a95dc7380353b559f2ddced70ab3e9d494 by Albert Vaca.
Committed on 09/09/2016 at 14:18.
Pushed by albertvaka into branch '1.x'.

Fixed clipboard propagation loop bug

M  +1    -0    plugins/clipboard/CMakeLists.txt
C  +9    -26   plugins/clipboard/clipboardlistener.cpp [from: plugins/clipboard/clipboardplugin.cpp - 054% similarity]
C  +28   -20   plugins/clipboard/clipboardlistener.h [from: plugins/clipboard/clipboardplugin.h - 059% similarity]
M  +5    -22   plugins/clipboard/clipboardplugin.cpp
M  +1    -4    plugins/clipboard/clipboardplugin.h

http://commits.kde.org/kdeconnect-kde/c19f26a95dc7380353b559f2ddced70ab3e9d494
Comment 16 know1 2016-09-10 08:43:43 UTC
Error loading QML file: file:///usr/share/plasma/plasmoids/org.kde.kdeconnect/contents/ui/main.qml:24:1: plugin cannot be loaded for module "org.kde.kdeconnect": Cannot load library /usr/lib64/qt5/qml/org/kde/kdeconnect/libkdeconnectdeclarativeplugin.so: (/usr/lib64/qt5/qml/org/kde/kdeconnect/libkdeconnectdeclarativeplugin.so: undefined symbol: _ZTI21DevicesSortProxyModel)
Comment 17 know1 2016-09-10 09:17:27 UTC
Laptop fixed with the update but my desktop has no kdeconnect and shows this;

https://drive.google.com/open?id=0ByCssmFGnnHaRjdmNVQ1U2FPT2M
https://drive.google.com/open?id=0ByCssmFGnnHaaHVCTWtTM3VKVk0

?
Comment 18 know1 2016-09-10 13:56:03 UTC
Must be something to do with my KDE installation....
Comment 19 know1 2016-09-10 14:18:18 UTC
(In reply to ykmssg-n01 from comment #18)
> Must be something to do with my KDE installation....'ve reinstalled KDE and is no change in error.
I
Comment 20 know1 2016-09-10 16:38:24 UTC
Found the problem of old shared links in /usr/lib64 from install from source of kdeconnect I think it was!
Great work Albert!
The best app for KDE (Android)
Comment 21 Albert Vaca Cintora 2016-09-11 19:40:25 UTC
Git commit 62bf2ccab7712bf42841582ff58b765a06b83ca8 by Albert Vaca.
Committed on 11/09/2016 at 19:40.
Pushed by albertvaka into branch '1.x'.

Fixed clipboard propagation loop bug

Now ClipboardListener is a singleton

M  +33   -18   src/org/kde/kdeconnect/Plugins/ClibpoardPlugin/ClipboardListener.java
M  +20   -12   src/org/kde/kdeconnect/Plugins/ClibpoardPlugin/ClipboardPlugin.java

http://commits.kde.org/kdeconnect-android/62bf2ccab7712bf42841582ff58b765a06b83ca8
Comment 22 know1 2016-09-12 15:08:07 UTC
Not fixed!
Comment 23 Albert Vaca Cintora 2016-09-12 15:42:27 UTC
Did you build from git branch '1.x' sources? I just merged it into master in case you where building from there (I forgot when I first pushed the fix). Also, I'm uploading a new version of the Android app to the Play Store with the fix, while the desktop app release will happen next week.
Comment 24 know1 2016-09-12 21:16:25 UTC
No build from source now (as the trouble I had with what was left over from when I had done way back when..), I used the update pushed to Fedora24 (updates).
Just got the Android update..so will wait if any other update is to be issued.
Comment 25 know1 2016-09-26 13:16:16 UTC
Awesome thanks!