scottchiefbaker / dool

Python3 compatible fork of dstat
GNU General Public License v3.0
323 stars 64 forks source link

OverflowError: cannot convert float infinity to integer #3

Closed valkolaci closed 1 year ago

valkolaci commented 3 years ago
SUMMARY

dool (and dstat as well) regularly and randomly (from about once per a few hours to once per month) dies with OverflowError while printing the values, trying to convert infinity from float to integer. It sounds like a division by zero error earlier, resulting in infinity as the float value.

ISSUE TYPE
DSTAT VERSION
Dool 0.9.9
Written by Scott Baker <scott@perturb.org>
Forked from Dstat written by Dag Wieers <dag@wieers.com>
Homepage at https://github.com/scottchiefbaker/dool/

Platform posix/linux
Kernel 4.19.152-mygentoo-v1.x64
Python 3.8.6 (default, Dec 21 2020, 04:23:20) 
[GCC 9.3.0]

Terminal type: screen (color support)
Terminal size: 67 lines, 222 columns

Processors: 8
Pagesize: 4096
Clock ticks per secs: 100

internal:
        aio,cpu,cpu-adv,cpu-use,cpu24,disk,disk24,disk24-old,epoch,fs,int,int24,io,ipc,load,lock,mem,mem-adv,net,page,page24,proc,raw,socket,swap,swap-old,sys,tcp,time,udp,unix,vm,vm-adv,
        zones
/usr/share/dool:
        battery,battery-remain,condor-queue,cpufreq,dbus,disk-avgqu,disk-avgrq,disk-svctm,disk-tps,disk-util,disk-wait,dool,dool-cpu,dool-ctxt,dool-mem,fan,freespace,fuse,gpfs,gpfs-ops,helloworld,ib,
        innodb-buffer,innodb-io,innodb-ops,jvm-full,jvm-vm,lustre,md-status,memcache-hits,mongodb-conn,mongodb-mem,mongodb-opcount,mongodb-queue,mongodb-stats,mysql-io,mysql-keys,mysql5-cmds,mysql5-conn,
        mysql5-innodb,mysql5-innodb-basic,mysql5-innodb-extra,mysql5-io,mysql5-keys,net-packets,nfs3,nfs3-ops,nfsd3,nfsd3-ops,nfsd4-ops,nfsstat4,ntp,postfix,power,proc-count,qmail,redis,rpc,rpcd,
        sendmail,snmp-cpu,snmp-load,snmp-mem,snmp-net,snmp-net-err,snmp-sys,snooze,squid,test,thermal,top-bio,top-bio-adv,top-childwait,top-cpu,top-cpu-adv,top-cputime,top-cputime-avg,top-int,top-io,
        top-io-adv,top-latency,top-latency-avg,top-mem,top-oom,utmp,vm-cpu,vm-mem,vm-mem-adv,vmk-hba,vmk-int,vmk-nic,vz-cpu,vz-io,vz-ubc,wifi,zfs-arc,zfs-l2arc,zfs-zil

Built from latest git commit:

COMMIT=6b89f2d0b6e38e1c8d706e88a12e020367f5100d
SRC_URI="https://github.com/scottchiefbaker/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
OS / ENVIRONMENT

Linux

STEPS TO REPRODUCE

CLI used:

dool -D sda,sdb,sdc,sdd 3
EXPECTED RESULTS

It shoudn't crash

ACTUAL RESULTS
--total-cpu-usage-- --dsk/sda-----dsk/sdb-- -net/total- ---load-avg--- -----system----
usr sys idl wai stl| read  writ: read  writ| recv  send| 1m   5m  15m |      time     
  0   2  98   0   0|   0   153k:   0   470k|  52k   35k|0.42 0.40 0.31|Dec-28 21:35:26
  0   4  96   0   0|   0     0 :   0    14M|  70k   57k|0.39 0.39 0.31|Dec-28 21:35:29
  0   4  96   0   0|   0     0 :   0    18M| 248k  200k|0.44 0.40 0.31|Dec-28 21:35:32
  1   7  92   0   0|   0     0 :   0     0 | 136k  242k|0.44 0.40 0.31|Dec-28 21:35:35
  0   3  97   0   0|   0     0 :   0     0 |  38k   26k|0.40 0.40 0.31|Dec-28 21:35:38
  0  10  90   0   0|   0     0 :   0  1343k|  32k   22k|0.40 0.40 0.31|Dec-28 21:35:39Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.8/dool", line 2899, in <module>
    main()
  File "/usr/lib/python-exec/python3.8/dool", line 2751, in main
    scheduler.run()
  File "/usr/lib/python3.8/sched.py", line 151, in run
    action(*argument, **kwargs)
  File "/usr/lib/python-exec/python3.8/dool", line 2849, in perform
    line = line + o.show() + o.showend(totlist, vislist)
  File "/usr/lib/python-exec/python3.8/dool", line 559, in show
    line = line + cprintlist(self.val[name], ctype, self.width, scale)
  File "/usr/lib/python-exec/python3.8/dool", line 2146, in cprintlist
    ret = ret + sep + cprint(var, ctype, width, scale)
  File "/usr/lib/python-exec/python3.8/dool", line 2196, in cprint
    ret, c = dchg(var, width, base)
  File "/usr/lib/python-exec/python3.8/dool", line 2096, in dchg
    ret = str(int(round(var)))
OverflowError: cannot convert float infinity to integer
felixonmars commented 3 years ago

I get this whenever a network interface no longer exist, like powering off a virtual machine, etc.

rklasen commented 2 years ago

I can confirm this issue, both on dstat and the most recent dool version from AUR:

File "/usr/bin/dool", line 2908, in <module>
    main()
  File "/usr/bin/dool", line 2758, in main
    scheduler.run()
  File "/usr/lib/python3.10/sched.py", line 151, in run
    action(*argument, **kwargs)
  File "/usr/bin/dool", line 2858, in perform
    line = line + o.show() + o.showend(totlist, vislist)
  File "/usr/bin/dool", line 574, in show
    line = line + cprintlist(self.val[name], ctype, self.width, scale)
  File "/usr/bin/dool", line 2162, in cprintlist
    ret = ret + sep + cprint(var, ctype, width, scale)
  File "/usr/bin/dool", line 2212, in cprint
    ret, c = dchg(var, width, base)
  File "/usr/bin/dool", line 2112, in dchg
    ret = str(int(round(var)))
OverflowError: cannot convert float infinity to integer

This is the dool version:

dool --version
Dool 1.0.0
Written by Scott Baker <scott@perturb.org>
Forked from Dstat written by Dag Wieers <dag@wieers.com>
Homepage at https://github.com/scottchiefbaker/dool/

Platform posix/linux
Kernel 5.17.4-arch1-1
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]

Terminal type: xterm-256color (color support)
Terminal size: 54 lines, 131 columns

Processors: 24
Pagesize: 4096
Clock ticks per secs: 100

internal:
        aio,cpu,cpu-adv,cpu-use,cpu24,disk,disk24,disk24-old,epoch,fs,int,int24,io,ipc,load,lock,mem,mem-adv,
        net,page,page24,proc,raw,socket,swap,swap-old,sys,tcp,time,udp,unix,vm,vm-adv,zones
/usr/share/dool:
        battery,battery-remain,condor-queue,cpufreq,dbus,disk-avgqu,disk-avgrq,disk-svctm,disk-tps,disk-util,disk-wait,
        dool,dool-cpu,dool-ctxt,dool-mem,fan,freespace,fuse,gpfs,gpfs-ops,helloworld,ib,innodb-buffer,innodb-io,
        innodb-ops,jvm-full,jvm-vm,lustre,md-status,memcache-hits,mongodb-conn,mongodb-mem,mongodb-opcount,
        mongodb-queue,mongodb-stats,mysql-io,mysql-keys,mysql5-cmds,mysql5-conn,mysql5-innodb,mysql5-innodb-basic,
        mysql5-innodb-extra,mysql5-io,mysql5-keys,net-packets,nfs3,nfs3-ops,nfsd3,nfsd3-ops,nfsd4-ops,nfsstat4,ntp,
        postfix,power,proc-count,qmail,redis,rpc,rpcd,sendmail,snmp-cpu,snmp-load,snmp-mem,snmp-net,snmp-net-err,
        snmp-sys,snooze,squid,test,thermal,top-bio,top-bio-adv,top-childwait,top-cpu,top-cpu-adv,top-cputime,
        top-cputime-avg,top-int,top-io,top-io-adv,top-latency,top-latency-avg,top-mem,top-oom,utmp,vm-cpu,vm-mem,
        vm-mem-adv,vmk-hba,vmk-int,vmk-nic,vz-cpu,vz-io,vz-ubc,wifi,zfs-arc,zfs-l2arc,zfs-zil
Korkman commented 1 year ago

Still happens with dool 1.1.0

tomchon commented 1 year ago

i have the same question

12932 commented 1 year ago

I get this whenever a network interface no longer exist, like powering off a virtual machine, etc.

Same. I can reproduce it by removing a Wireguard network interface

Korkman commented 1 year ago

Yeah, the annoying thing is: docker is widespread and stopping containers also removes interfaces, crashes dool.

Partial workaround: name the interfaces to monitor with the argument -N dool -N eth0

Doesn't help with many interfaces meant to be summed up in a total.

scottchiefbaker commented 1 year ago

This issues SHOULD be addressed now in #16. If the issue remains, please re-open this issue.