linuxmint / warpinator

Share files across the LAN
GNU General Public License v3.0
1.21k stars 81 forks source link

CPU usage on Linux Mint 21 #137

Closed reticulatus closed 2 years ago

reticulatus commented 2 years ago

After doing fresh installs of LM 21 Mate on my 3 PCs I noticed that the warpinator process (v1.2.13) is running at a higher % cpu than it did on LM 20.3.

PC 1 (12 year old desktop) uses 10 - 11% cpu. PC 2 (1 year old desktop) uses 8 - 12% cpu. PC 3 (3 year old laptop) uses 17 - 28% cpu!

The cpu usage was measured while warpinator was not transferring any files.

I also noticed that the cpu usage tends to increase slowly over time while it is idle. After rebooting PC 2, warpinator was showing 8.6% cpu, but 40 minutes later it was showing 10.3%.

I also tested it running from a live LM 21 Mate ISO and got similar figures to the PC running its installed version.

I posted a message about this on Linux Mint forums: https://forums.linuxmint.com/viewtopic.php?f=47&t=380052.

One member running a fresh install of LM 21 Cinnamon was only getting 3.5 to 4%, which is the sort of figure I would have expected.

Another member running LM 21 Xfce on an HP Elitebook was getting 17.5% to 18%.

Is this a known issue?

What is warpinator doing that uses this much cpu?

Is there anything that can be done to reduce cpu usage, apart from closing the application when not required?

mtwebster commented 2 years ago

It should be using next to nothing when idle. Two machines I just checked both show ~1-3% at idle. During a transfer it goes up to around 4%.

This is in Cinnamon - I'll try mate and xfce when I get a chance.

If you run it from a terminal using warpinator --debug does it show anything?

reticulatus commented 2 years ago

I just tried it with --debug. Here is the output:

richardt@Pavilion:~ $ warpinator --debug 2022-08-31 15:27:46,093::warpinator: Initializing Warpinator 2022-08-31 15:27:46,094::warpinator::DEBUG: UI: Creating window and status icon -- warpinator.py (line 1030) 2022-08-31 15:27:46,337::warpinator::DEBUG: Starting network monitor -- networkmonitor.py (line 52) 2022-08-31 15:27:46,338::warpinator::DEBUG: Network state changed: online = True -- networkmonitor.py (line 144) 2022-08-31 15:27:46,338::warpinator::DEBUG: New server requested for 'wlp3s0' (192.168.1.2) -- warpinator.py (line 1082) 2022-08-31 15:27:46,339::warpinator::DEBUG: Auth: Creating server credentials -- auth.py (line 216) 2022-08-31 15:27:46,965::warpinator::DEBUG: Server: starting server on 192.168.1.2 (wlp3s0) -- server.py (line 278) 2022-08-31 15:27:46,965::warpinator: Using api version 2 2022-08-31 15:27:46,965::warpinator: Our uuid: PAVILION-61A217ECDF5726832CFB 2022-08-31 15:27:46,965::warpinator::DEBUG: Starting v1 registration server (192.168.1.2) with port 42000 -- remote_registration.py (line 59) 2022-08-31 15:27:46,966::warpinator::DEBUG: Starting v2 registration server (192.168.1.2) with auth port 42001 -- remote_registration.py (line 61) 2022-08-31 15:27:46,986::warpinator: Using bundled zeroconf v0.29.0 2022-08-31 15:27:54,440::warpinator::DEBUG: Registration Server RPC: RequestCertificate from Avalon '192.168.1.2' -- remote_registration.py (line 305) 2022-08-31 15:27:54,662::warpinator::DEBUG: Server RPC: WaitingForDuplex from 'Avalon' (api v2) -- server.py (line 404) 2022-08-31 15:27:54,845::warpinator::DEBUG: >>> Discovery: new remote: Avalon (192.168.1.3:42000) -- server.py (line 246) 2022-08-31 15:27:54,846::warpinator: Registering with Avalon (192.168.1.3:42001) - api version 2 2022-08-31 15:27:54,846::warpinator::DEBUG: remote-registration-thread-Avalon-192.168.1.3:42001-AVALON-234F149853F7975C1723 -- remote_registration.py (line 240) 2022-08-31 15:27:54,846::warpinator: Server: ACTIVE 2022-08-31 15:27:54,846::warpinator::DEBUG: Remote: Attempting to register Avalon (192.168.1.3) -- remote_registration.py (line 258) 2022-08-31 15:27:54,868::warpinator::DEBUG: UI: start discovery timer (no remotes) -- warpinator.py (line 784) 2022-08-31 15:27:55,077::warpinator::DEBUG: Remote: Attempting to connect to Avalon (192.168.1.3) - api version 2 -- remote.py (line 197) 2022-08-31 15:27:55,096::warpinator::DEBUG: Remote: waiting for duplex from 'Avalon' -- remote.py (line 349) 2022-08-31 15:27:55,096::warpinator::DEBUG: Remote: Avalon is now RemoteStatus.AWAITING_DUPLEX -- remote.py (line 312) 2022-08-31 15:27:55,100::warpinator::DEBUG: Remote RPC: calling GetRemoteMachineInfo on 'Avalon' -- remote.py (line 358) 2022-08-31 15:27:55,101::warpinator::DEBUG: Remote RPC: calling GetRemoteMachineAvatar on 'Avalon' -- remote.py (line 377) 2022-08-31 15:27:55,105::warpinator::DEBUG: Remote RPC: could not fetch remote avatar, using a generic one. (StatusCode.NOT_FOUND, .face file not found!) -- remote.py (line 387) 2022-08-31 15:27:55,106::warpinator::DEBUG: Remote: Avalon is now RemoteStatus.ONLINE -- remote.py (line 312) 2022-08-31 15:27:55,169::warpinator::DEBUG: Server RPC: GetRemoteMachineInfo from 'Avalon' -- server.py (line 432) 2022-08-31 15:27:55,170::warpinator::DEBUG: Server RPC: GetRemoteMachineAvatar from 'Avalon' -- server.py (line 438) 2022-08-31 15:30:15,056::warpinator::DEBUG: Beginning shutdown -- warpinator.py (line 1138) 2022-08-31 15:30:15,058::warpinator::DEBUG: Stopping network monitor -- networkmonitor.py (line 58) 2022-08-31 15:30:15,058::warpinator::DEBUG: Setting up kill -- warpinator.py (line 1170) 2022-08-31 15:30:15,059::warpinator::DEBUG: Stopping v1 registration server. -- remote_registration.py (line 71) 2022-08-31 15:30:15,100::warpinator::DEBUG: Stopping v2 registration server. -- remote_registration.py (line 76) 2022-08-31 15:30:15,101::warpinator::DEBUG: Server: stopping discovery and advertisement -- server.py (line 331) 2022-08-31 15:30:15,353::warpinator::DEBUG: Server: Closing connection to remote machine Avalon (192.168.1.3:42000) -- server.py (line 344) 2022-08-31 15:30:15,397::warpinator::DEBUG: Remote: Avalon is now RemoteStatus.OFFLINE **** -- remote.py (line 312) 2022-08-31 15:30:15,397::warpinator::DEBUG: Server: terminating server -- server.py (line 351) 2022-08-31 15:30:15,401::warpinator::DEBUG: Server: server stopped -- server.py (line 358) 2022-08-31 15:30:15,449::warpinator::DEBUG: Shutdown complete -- warpinator.py (line 1160)

When it had finished initialising, the cpu was 14.3%.

mtwebster commented 2 years ago

I did a quick check on a mate and xfce virtual machine, and it looks like the issue is only apparent in mate - the process never actually 'sleeps'. I'll try to see what's keeping it active.

mtwebster commented 2 years ago

Could I get you to try this package out? I can actually reproduce on Cinnamon as well. I've narrowed it down to a version of a library we use (grpc for data transfer). This has a slightly older version included, and I can't reproduce the issue with it.

warpinator-grpc-1.44.tar.gz

You should be able to extract that and just double-click the .deb file (or run dpkg -i *.deb in the location you extract it to).

Thanks

reticulatus commented 2 years ago

I have installed the package on all 3 of my PCs running LM 21 Mate. After letting the new warpinator process settle down I am now getting: PC1 : 0.5% PC2 : 1.4% PC3 : 1.2%

That's a big reduction! I also copied a couple of files with no issues.