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

Issue 760547 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug



Sign in to add a comment

chrome.devtools.network.onRequestFinished returning negative time

Reported by lbroc...@fastly.com, Aug 30 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36

Steps to reproduce the problem:
1. Build DevTool extension that uses chrome.devtools.network.onRequestFinished
2. Inspect the "time" property of the entry
3. Observe that it is negative

What is the expected behavior?
"time" should be a positive number.

Entries are in HTTP Archive format (HAR). The "time" property, according to http://www.softwareishard.com/blog/har-12-spec/ should be "Total elapsed time of the request in milliseconds. This is the sum of all timings available in the timings object (i.e. not including -1 values)"

What went wrong?
It includes the -1 values.

{
  "startedDateTime": "2017-08-30T12:28:20.782Z",
  "time": -2.9640000169165432,
  ...
}

Did this work before? No 

Chrome version: 60.0.3112.101  Channel: stable
OS Version: OS X 10.11.6
Flash Version: 

The current line is:

https://github.com/ChromeDevTools/devtools-frontend/blob/e3189d64626ae16065a731d22f3c6557d032f757/front_end/network_log/HAREntry.js#L66
    var time = timings.blocked + timings.dns + timings.connect + timings.send + timings.wait + timings.receive;

... which includes the special "-1" entries, so sometimes give a negative time.  

Perhaps it should be something like the following?

const time =
    (entry.timings.blocked === -1 ? 0 : entry.timings.blocked) +
    (entry.timings.dns === -1 ? 0 : entry.timings.dns) +
    (entry.timings.connect === -1 ? 0 : entry.timings.connect) +
    (entry.timings.send === -1 ? 0 : entry.timings.send) +
    (entry.timings.wait === -1 ? 0 : entry.timings.wait) +
    (entry.timings.receive === -1 ? 0 : entry.timings.receive) +
    (entry.timings.ssl === -1 ? 0 : entry.timings.ssl);
 
disk.json
1.9 KB View Download
Owner: caseq@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 2 by caseq@chromium.org, Sep 1 2017

Cc: caseq@chromium.org
Labels: -Pri-2 Pri-1
Owner: allada@chromium.org

Comment 3 by caseq@chromium.org, Sep 1 2017

Components: -Platform>DevTools Platform>DevTools>Network
Owner: eostroukhov@chromium.org
Project Member

Comment 5 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1060ac80119b1cf5a09813f7a96fe1f33a2b40af

commit 1060ac80119b1cf5a09813f7a96fe1f33a2b40af
Author: Eugene Ostroukhov <eostroukhov@chromium.org>
Date: Thu Jan 04 01:08:36 2018

DevTools: ensure request time is never negative.

1. Do not initialize 'receive' timestamp with -1. Quoting
   the spec: "The send, wait and receive timings are not optional
   and must have non-negative values."
2. Account for a possibility of blocked, dns, connect and ssl fields
   beeing -1.

Bug:  760547 
Change-Id: I82693812a2f7aea1edfea53d85212e0f09d43360
Reviewed-on: https://chromium-review.googlesource.com/835471
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Eugene Ostroukhov <eostroukhov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526883}
[modify] https://crrev.com/1060ac80119b1cf5a09813f7a96fe1f33a2b40af/third_party/WebKit/Source/devtools/front_end/network_log/HAREntry.js

Status: Fixed (was: Assigned)

Sign in to add a comment