jetson_stats
jetson_stats copied to clipboard
Crash ZeroDivsionError
Describe the bug
During high load where processes are often started and run for short periods, it is possible to crash jtop with a ZeroDivisionError. This can happen when jtop enumerate processes almost exactly as they started resulting in the following expression being so close to zero that it is considered zero. https://github.com/rbonghi/jetson_stats/blob/e22b49f0250cd1b81aaa4a311af51d01cf219cf1/jtop/core/processes.py#L109
To Reproduce
Steps to reproduce the behavior:
- Create a script that quickly starts a short-lived process in an infinte loop and run it in the background
- Open jtop
- Wait for the jtop service to crash
- See error
Expected behavior
jtop not crashing during such system loads.
proc_uptime = max(1, uptime - starttime)
would solve the issue but may cause newly spawned processes load to be underrepresented (<1s), however this would also prevent jtop from attempting to extrapolate process load when basically no statisics exist yet.
Board
- jetson-stats version: 2.4.7
- Jetpack: 5.1.3
- L4T: 35.5.0