You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
im_mad/lib/process_list.rb: guard against cpu_j == 0 and negative delta when process exits #8195
If cpu_j <= 0 (for example if /proc/stat fails or returns identical ticks), (proc_jiffies(pid) - cpu_ini[pid]) / cpu_j produces NaN or Infinity, and .round(2) / .to_i raises FloatDomainError.
If a monitored process terminates during sleep AVERAGE_SECS, proc_jiffies(pid) rescues Errno::ENOENT and returns 0, making proc_jiffies(pid) - cpu_ini[pid] negative and reporting negative CPU usage.
To Reproduce
Call ProcessList.cpu_info when a process exits during sleep AVERAGE_SECS or when cpu_j == 0.
Observe negative CPU percentage or FloatDomainError: NaN.
Expected behavior ProcessList.cpu_info should check cpu_j > 0 and j_end >= cpu_ini[pid], setting cpu[pid] = 0.0 otherwise.
Details
Affected Component: IM monitoring library (src/im_mad/remotes/lib/process_list.rb)
Version: master and 7.0.1
Progress Status
Code committed
Testing - QA
Documentation (Release notes - resolved issues, compatibility, known issues)
Activity
B #8195: Guard against cpu_j <= 0 and exited PIDs in ProcessList.cpu_…
B OpenNebula/one#8183, OpenNebula/one#8191, OpenNebula/one#8194, Open…