hakandundar34coding / system-monitoring-center

Multi-featured system monitor
GNU General Public License v3.0
912 stars 84 forks source link

GUI freezes when Disk tab is open and online drive(s) are connected #134

Closed Hayashi-Tensai closed 1 year ago

Hayashi-Tensai commented 1 year ago

It seems that ever since a few updates ago, when entering the [disk] tab, it will constantly freeze and only accept inputs around every few seconds

hakandundar34coding commented 1 year ago

What is the version of System Monitoring Center? How was the application installed (from PyPI, Flatpak, etc.)? Are there any errors when the application is run from terminal? What is your CPU model? How many disks are listed on Disk tab?

Hayashi-Tensai commented 1 year ago

I have tested this on both PyPi (v1.37.1) and Flatpak(v2.3.0) versions. No errors for both versions when ran through terminal.

CPU Model is AMD Ryzen 5 3600X, I have 1 SSD (500GB) and 2 HDDs (2TB each). 7 disks are displayed on the disk tab (3 for hardware, 4 are partitions)

image

hakandundar34coding commented 1 year ago

Can you share output of these commands? time df --output=source,fstype,size,used,avail,pcent,target time lsblk -no KNAME,FSTYPE

Hayashi-Tensai commented 1 year ago

time df --output=source,fstype,size,used,avail,pcent,target

df: /run/user/1000/doc: Operation not permitted
Filesystem     Type      1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs   16358088          0   16358088   0% /dev
tmpfs          tmpfs       3279908       1740    3278168   1% /run
/dev/nvme0n1p1 ext4      479596200   35978216  419182324   8% /
tmpfs          tmpfs      16399520     266000   16133520   2% /dev/shm
tmpfs          tmpfs          5120          4       5116   1% /run/lock
/dev/sdb5      ext4     1921736504  741856344 1082188164  41% /home
/dev/sda1      ext4     1921724608 1130633700  693398852  62% /media/tensai/Red Heart
tmpfs          tmpfs       3279904      10204    3269700   1% /run/user/1000

real    0m0.001s
user    0m0.001s
sys 0m0.000s

time lsblk -no KNAME,FSTYPE

sda       
sda1      ext4
sdb       
sdb3      
sdb5      ext4
nvme0n1   
nvme0n1p1 ext4

real    0m0.004s
user    0m0.004s
sys 0m0.000s
Hayashi-Tensai commented 1 year ago

Some additional details:

While launching startup apps

real    0m0.612s
user    0m0.000s
sys 0m0.001s

After startup apps are done launching

real    0m0.546s
user    0m0.000s
sys 0m0.001s
Hayashi-Tensai commented 1 year ago

Update on the above results, it seems that there is an app I am using called Onedriver that is causing the slowdown, the app mounts the onedrive cloud into the file directory, and seems to be not mounted when I did the test earlier

With Onedriver mounted

df: /run/user/1000/doc: Operation not permitted
Filesystem     Type            1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs         16358088          0   16358088   0% /dev
tmpfs          tmpfs             3279908       1732    3278176   1% /run
/dev/nvme0n1p1 ext4            479596200   35991204  419169336   8% /
tmpfs          tmpfs            16399520     200956   16198564   2% /dev/shm
tmpfs          tmpfs                5120          4       5116   1% /run/lock
/dev/sdb5      ext4           1921736504  741841976 1082202532  41% /home
/dev/sda1      ext4           1921724608 1130633700  693398852  62% /media/tensai/Red Heart
tmpfs          tmpfs             3279904       9380    3270524   1% /run/user/1000
onedriver      fuse.onedriver    5242880     235180    5007700   5% /home/tensai/Onedrive/Usami-Kumiko
onedriver      fuse.onedriver    5767168    3777396    1989772  66% /home/tensai/Onedrive/Hayashi-Tensai

real    0m0.612s
user    0m0.000s
sys 0m0.001s

When Onedriver is not mounted

df: /run/user/1000/doc: Operation not permitted
Filesystem     Type      1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs   16358088          0   16358088   0% /dev
tmpfs          tmpfs       3279908       1724    3278184   1% /run
/dev/nvme0n1p1 ext4      479596200   35966316  419194224   8% /
tmpfs          tmpfs      16399520     193040   16206480   2% /dev/shm
tmpfs          tmpfs          5120          4       5116   1% /run/lock
/dev/sdb5      ext4     1921736504  741851004 1082193504  41% /home
/dev/sda1      ext4     1921724608 1130633700  693398852  62% /media/tensai/Red Heart
tmpfs          tmpfs       3279904       9388    3270516   1% /run/user/1000

real    0m0.002s
user    0m0.001s
sys 0m0.000s

The [disk] tab also runs smoothly now after un-mounting the Onedriver's mount points. Not too sure if this is an issue that can be fixed on your side or Onedriver's side

hakandundar34coding commented 1 year ago

Does it work faster if the following command is used when the online drive is connected? time df --exclude-type=fuse.onedriver --output=source,fstype,size,used,avail,pcent,target

Hayashi-Tensai commented 1 year ago

Yeah looks like it does

time df --output=source,fstype,size,used,avail,pcent,target

real    0m0.657s
user    0m0.002s
sys 0m0.000s

time df --exclude-type=fuse.onedriver --output=source,fstype,size,used,avail,pcent,target

real    0m0.001s
user    0m0.001s
sys 0m0.000s
hakandundar34coding commented 1 year ago

The online drives will be listed as [Not mounted] and disk usage information for these disks will not be shown if --exclude-type=fuse.onedriver parameter is added to the command in a newer version.

What do you think?


Can you run this command when the online drive is connected and share the result? time df --local --output=source,fstype,size,used,avail,pcent,target

Hayashi-Tensai commented 1 year ago

What do you think?

Yeah I think that would good, I don't think online drives needs to be shown the in the app


time df --local --output=source,fstype,size,used,avail,pcent,target

This command still displays the online drives

Filesystem     Type            1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs         16358088          0   16358088   0% /dev
tmpfs          tmpfs             3279908       1744    3278164   1% /run
/dev/nvme0n1p1 ext4            479596200   36282056  418878484   8% /
tmpfs          tmpfs            16399520     282672   16116848   2% /dev/shm
tmpfs          tmpfs                5120          4       5116   1% /run/lock
/dev/sda5      ext4           1921736504  741993420 1082051088  41% /home
/dev/sdb1      ext4           1921724608 1112412168  711620384  61% /media/tensai/Red Heart
tmpfs          tmpfs             3279904       9400    3270504   1% /run/user/1000
onedriver      fuse.onedriver    5242880     235180    5007700   5% /home/tensai/Onedrive/Usami-Kumiko
onedriver      fuse.onedriver    5767168    3777396    1989772  66% /home/tensai/Onedrive/Hayashi-Tensai

real    0m0.518s
user    0m0.002s
sys 0m0.000s

time df --exclude-type=fuse.onedriver --output=source,fstype,size,used,avail,pcent,target

Where the one you gave earlier does exclude the onedrive drive, tho not sure if there is a command that exclude all online drives, which I presume that is what you might want to go for

Filesystem     Type      1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs   16358088          0   16358088   0% /dev
tmpfs          tmpfs       3279908       1744    3278164   1% /run
/dev/nvme0n1p1 ext4      479596200   36282676  418877864   8% /
tmpfs          tmpfs      16399520     282672   16116848   2% /dev/shm
tmpfs          tmpfs          5120          4       5116   1% /run/lock
/dev/sda5      ext4     1921736504  741994484 1082050024  41% /home
/dev/sdb1      ext4     1921724608 1112412172  711620380  61% /media/tensai/Red Heart
tmpfs          tmpfs       3279904       9400    3270504   1% /run/user/1000

real    0m0.001s
user    0m0.000s
sys 0m0.001s
hakandundar34coding commented 1 year ago

Getting disk information may be slower if internet connection is slow or if there are other problems.

Another option: Adding an option for showing/hiding online drives.


Can you run this command?

time df -l --output=source,fstype,size,used,avail,pcent,target

There may be a bug for --local parameter.

Currently, only disks with fuse.onedriver filesystem are not listed. Did you use another tool similar to this one? What were the filesystems? Did they start with fuse.?

Hayashi-Tensai commented 1 year ago

time df -l --output=source,fstype,size,used,avail,pcent,target

This command still returns the fuse.onedriver file systems

Filesystem     Type            1K-blocks       Used      Avail Use% Mounted on
udev           devtmpfs         16358088          0   16358088   0% /dev
tmpfs          tmpfs             3279908       1728    3278180   1% /run
/dev/nvme0n1p1 ext4            479596200   36435284  418725256   9% /
tmpfs          tmpfs            16399520     139244   16260276   1% /dev/shm
tmpfs          tmpfs                5120          4       5116   1% /run/lock
/dev/sdc1      ext4           1921724608 1112679400  711353152  62% /media/tensai/Red Heart
/dev/sda5      ext4           1921736504  742038520 1082005988  41% /home
tmpfs          tmpfs             3279904       9352    3270552   1% /run/user/1000
onedriver      fuse.onedriver    5242880     235180    5007700   5% /home/tensai/Onedrive/Usami-Kumiko
onedriver      fuse.onedriver    5767168    3777396    1989772  66% /home/tensai/Onedrive/Hayashi-Tensai

real    0m0.570s
user    0m0.002s
sys 0m0.000s

Currently, only disks with fuse.onedriver filesystem are not listed. Did you use another tool similar to this one? What were the filesystems? Did they start with fuse.?

I have just trying adding my google drive to filesystem using kio-gdrive and seems that it is not listed in the command on above and doesn't branch from the root directory like onedriver does but instead uses gdrive:/username@gmail.com/


Another option: Adding an option for showing/hiding online drives.

I have a suggestion, I just found out that fuse.* filesystems are used for custom filesystems which would be impossible to keep track on all of them. What if the app allow users to exclude any filesystem type they would like to exclude from the [disk] tab?

hakandundar34coding commented 1 year ago

This may be used but it increases complexity. Selectable options are simpler.

Another option: All filesystems that start with fuse. may be blocked. or Only fuse.onedriver may be blocked. Additional disks may be blocked if they are reported.

Hayashi-Tensai commented 1 year ago

All filesystems that start with fuse. may be blocked. or Only fuse.onedriver may be blocked. Additional disks may be blocked if they are reported.

Yeah, I think if the first option would work and users can choose to enable or not, though I wasn't able replicate a wildcard exclude for fuse.* filesystem types. Maybe you might be able to figure out that part.

hakandundar34coding commented 1 year ago

Which version (3 or 4) of GTK is installed on your system? I will update the code for testing?


Can you follow these steps?

Hayashi-Tensai commented 1 year ago

Which version (3 or 4) of GTK is installed on your system? I will update the code for testing?

GTK 3


Can you follow these steps?

I have tested using the smc_v1 branch, and after replacing the code you have given, the responsiveness is still slow as before


Edit 1: It seems that this loop that we are modifying the condition on, the fuse.onedriver does not seem to appear is the device_list_full array

image

Edit 2: After looking through the code for a bit, even after adding the --exclude-type=fuse.onedriver to the df parameters it still shows onedriver in the listing, where else in the terminal this same parameter will exclude the onedriver filesystem. Which I find that a bit strange...

image

hakandundar34coding commented 1 year ago

About Edit 1: device_list is affected when the condition is changed.

About Edit 2: Using a command_list like this one may fix the problem: command_list = ["df", "--exclude-type=fuse.onedriver", "--output=source,fstype,size,used,avail,pcent,target"]

Each command parameter is an element of the Python list.


What is the name of the onedrive application? Is it Onedriver? How did you install it?


Edit: The application is tested. The drive is not listed in /proc/partitions and /proc/diskstats files. It will be excluded without any option. Currently, this command will be used: df --exclude-type=fuse.onedriver --output=source,fstype,size,used,avail,pcent,target

More filesystem types can be added by using the parameter multiple times (comma-separated --exclude-type parameter does not work): df --exclude-type=fuse.onedriver --exclude-type=another_filesystem --output=source,fstype,size,used,avail,pcent,target

The Python code for this: command_list = ["df", "--exclude-type=fuse.onedriver", "--output=source,fstype,size,used,avail,pcent,target"]

Hayashi-Tensai commented 1 year ago

Each command parameter is an element of the Python list.

Ah I see, thanks for the info. It has been a while ever since I used Python.


What is the name of the onedrive application? Is it Onedriver? How did you install it?

It is from this repo https://github.com/jstaf/onedriver I am using the Debian option in the readme file as I am currently running LMDE5


Edit: The application is tested.

I am not too sure whether you have tested using Onedriver based on your statement, but I'll provide you the link above if you still need it

hakandundar34coding commented 1 year ago

I installed the same application that you wrote. I updated the previous comment.

There will be new versions for SMC v1 and v2 in about 1 week and drives with fuse.onedriver will be excluded.

hakandundar34coding commented 1 year ago

v2.4.0 and v1.39.0 include bug fix for online drives. You can write comment if there are problems.

Hayashi-Tensai commented 1 year ago

I have tested on both the PyPi and Flatpak versions, the [disk] tab now runs smoothly when fuse.onedrive drives are attached