This will solve the issue:

--- /usr/bin/dstat.orig 2020-06-05 08:54:42.376561626 +0200
+++ /usr/bin/dstat      2020-06-05 09:05:08.316386102 +0200
@@ -2034,6 +2034,8 @@
     "Convert decimal to string given base and length"
     c = 0
     while True:
+        if var == float('inf'):
+            return 'Inf', c
         ret = str(int(round(var)))
         if len(ret) <= width:
             break
@@ -2168,10 +2170,13 @@

     ### Add unit to output
     if unit:
-        if c != -1 and round(var) != 0:
-            ret += cunit + units[c]
-        else:
-            ret += char['space']
+        try:
+            if c != -1 and round(var) != 0:
+                ret += cunit + units[c]
+            else:
+                ret += char['space']
+        except OverflowError:
+            pass

     return ret


It will produce output like this:


usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw
 11   3  86   0   0|1407B 1294k|   0     0 |   0     0 |  26k   59k
 44   8  48   0   0|   0  6176k|3442k 5642k|   0     0 |  70k  243k
 36   7  57   0   0|   0  2768k|1533k 2351k|   0     0 |  58k  206k
 34   7  59   0   0|   0    14M|3895k 5211k|   0     0 |  63k  210k
 28   7  66   0   0|   0    16M|3484k 5652k|   0     0 |  61k  184k
 27   5  68   0   0|   0  2848k|1648k 2375k|   0     0 |  54k  177k
 36   7  58   0   0|   0  1480k|1637k 2267k|   0     0 |  63k  220k
 34   7  60   0   0|   0  2856k|1375k 1936k|   0     0 |  56k  213k
 35   7  57   0   0|   0    51M| 836k 1084k|   0     0 |  57k  237k
 36   7  57   0   0|   0  1000k| 884k 1159k|   0     0 |  52k  237k
 35   7  58   0   0|   0  2136k|1157k 1686k|   0     0 |  55k  233k
 38   8  54   0   0|   0  2208k|1046k 1468k|   0     0 |  56k  240k
 39   8  53   0   0|   0  2264k|5581k   10M|   0     0 |  61k  244k
 38   9  54   0   0|   0  6592k|  34M   63M|   0     0 |  63k  245k
 23  51  25   0   0|   0    19M|1787k 1000k|   0     0 | 201k  241k
 20   4  76   0   0|   0  4592k|  12M 4517k|   0     0 |  55k  111k
 15   3  82   0   0|   0  2632k|  12M 3742k|   0     0 |  52k  113k
 16   2  82   0   0|   0  1796k|  12M 3586k|   0     0 |  56k  100k
 16   3  81   0   0|   0    28M|8235k 1948k|   0     0 |  58k  106k
 17   3  80   0   0|   0  4496k|  15M 4639k|   0     0 |  53k  127k
 19  11  70   0   0|   0  4712k|9915k  Inf|   0     0 |  53k  134k
 22   6  72   0   0|   0  8672k| Inf  Inf|   0     0 |  57k  163k
 18   4  78   0   0|   0    11M| Inf  Inf|   0     0 |  55k  126k
 13   4  83   0   0|   0  8672k| Inf  Inf|   0     0 |  54k  122k
 14   4  82   0   0|   0  9056k| Inf  Inf|   0     0 |  55k  127k
 13   3  84   0   0|   0  8960k| Inf  Inf|   0     0 |  57k  101k
 17   4  80   0   0|   0  8360k| Inf  Inf|   0     0 |  55k  127k
 29  23  48   0   0|   0    40M| 437k 1027k|   0     0 | 132k  413k
 29   8  63   0   0|   0  3952k|1790k 1617k|   0     0 |  74k  219k
 42  12  47   0   0|   0  9368k|3705k 6440k|   0     0 |  83k  239k
 50  10  40   0   0|   0  8160k|2555k 2673k|   0     0 |  74k  204k

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1866619

Title:
  OverflowError when machine suspends and resumes after a longer while

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dstat/+bug/1866619/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to