jetson_stats icon indicating copy to clipboard operation
jetson_stats copied to clipboard

Crash ZeroDivsionError

Open evildeeds opened this issue 9 months ago • 2 comments

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:

  1. Create a script that quickly starts a short-lived process in an infinte loop and run it in the background
  2. Open jtop
  3. Wait for the jtop service to crash
  4. 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

evildeeds avatar May 16 '24 06:05 evildeeds