New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Dec 20
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

graphics_Idle - Unhandled ZeroDivisionError: float division by zero

Project Member Reported by jrbarnette@chromium.org, Dec 19

Issue description

This paladin run failed:
    https://luci-milo.appspot.com/buildbot/chromeos/nyan_big-paladin/3880

The failure was because of this test:
    http://cautotest-prod.corp.google.com/afe/#tab_id=view_job&object_id=163699290

That test failed because of this:
Traceback (most recent call last):
  File "/usr/local/autotest/common_lib/test.py", line 831, in _call_test_function
    return func(*args, **dargs)
  File "/usr/local/autotest/common_lib/test.py", line 495, in execute
    dargs)
  File "/usr/local/autotest/common_lib/test.py", line 362, in _call_run_once_with_retry
    postprocess_profiled_run, args, dargs)
  File "/usr/local/autotest/common_lib/test.py", line 400, in _call_run_once
    self.run_once(*args, **dargs)
  File "/usr/local/autotest/tests/graphics_Idle/graphics_Idle.py", line 48, in run_once
    if not utils.wait_for_idle_cpu(20.0, 0.1):
  File "/usr/local/autotest/bin/utils.py", line 1640, in wait_for_idle_cpu
    compute_active_cpu_time(cpu_usage_start, cpu_usage_end)
  File "/usr/local/autotest/bin/utils.py", line 1612, in compute_active_cpu_time
    (total_time_end - total_time_start))
ZeroDivisionError: float division by zero

Here's the source code around the failure:
    def compute_active_cpu_time(cpu_usage_start, cpu_usage_end):
        idle_cols = ('idle', 'iowait')  # All other cols are calculated as active.    
        time_active_start = sum([x[1] for x in cpu_usage_start.iteritems()
                                 if x[0] not in idle_cols])
        time_active_end = sum([x[1] for x in cpu_usage_end.iteritems()
                               if x[0] not in idle_cols])
        total_time_start = sum(cpu_usage_start.values())
        total_time_end = sum(cpu_usage_end.values())
        return ((float(time_active_end) - time_active_start) /
                (total_time_end - total_time_start))

So, the error happened because the routine's estimate of "time
elapsed" was calculated to be 0.

Assigning to a sheriff to figure out who owns this test.  There's a
good chance that ihf@ knows the answer...
 
Cc: bmgordon@google.com
 Issue 796214  has been merged into this issue.
Owner: ayatane@chromium.org
Over to ayatane@ who wrote the failing function.
I didn't write this, I probably just touched it during refactoring.
Owner: bmgordon@chromium.org
Back to bmgordon@ - talk to the graphics team to find an owner.

Owner: ihf@chromium.org
Status: Started (was: Assigned)
This is exceptionally rare (and honestly not something that should be expected on a proper DUT, but then again this is Tegra). I've modified the code to avoid the division by zero.
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/b2b28b3f232b01901fc173adab418503b90caa09

commit b2b28b3f232b01901fc173adab418503b90caa09
Author: Ilja H. Friedel <ihf@chromium.org>
Date: Wed Dec 20 20:53:47 2017

utils: avoid division by zero.

This is an exceptionally rare case, but has been observed once
on a Tegra Chromebook.

BUG= chromium:796212 
TEST=None.

Change-Id: I6ddf7fecca3a6c9ab676f5a8574079ebb0dd0f23

[modify] https://crrev.com/b2b28b3f232b01901fc173adab418503b90caa09/client/bin/utils.py

Status: Verified (was: Started)

Sign in to add a comment