paulirish / devtools-timeline-model

Unsupported
Other
174 stars 35 forks source link

error : Multiple sessions in trace #15

Open xuyuan923 opened 8 years ago

xuyuan923 commented 8 years ago

I used json file you provided form your github project in test/assets/ is ok. But I used this module to test my performance json file. my performance json file is traced by like this, eg:

var traceCategories = [
  'blink.console',
  'devtools.timeline',
  'disabled-by-default-devtools.timeline',
  'toplevel',
  'disabled-by-default-devtools.timeline.frame',
  'disabled-by-default-devtools.timeline.stack',
  'disabled-by-default-devtools.timeline.layers'
];

It got error:

assert.js:90
  throw new assert.AssertionError({
  ^
AssertionError: Multiple sessions in trace
    at Console.assert (console.js:95:23)
    at Console.console.assert (chrome-devtools-frontend/front_end/platform/utilities.js:38:13)
    at Object.WebInspector.TimelineModel._processMetadataEvents (chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js:534:25)
    at Object.WebInspector.TimelineModel.setEvents (chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js:494:35)
    at SandboxedModel.init (evalmachine.<anonymous>:74:25)
    at new ModelAPI (/Users/cassie/gitlab-workspace/WebDriver/node_modules/devtools-timeline-model/index.js:29:18)
    at report (/Users/cassie/gitlab-workspace/WebDriver/devtools-timeline-model.js:29:15)
    at Object.<anonymous> (/Users/cassie/gitlab-workspace/WebDriver/devtools-timeline-model.js:71:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)

sorry for my poor English. :)

paulirish commented 8 years ago

@xuyuan923 you're recording the trace via the perfLogs in webdriver?

@caseq do we need to throw in this case? Can we recover in these situations?

sblancov commented 7 years ago

Could it be something related to events with 'TracingStartedInBrowser' name?

https://github.com/ChromeDevTools/devtools-frontend/blob/master/front_end/timeline_model/TimelineModel.js#L289-L292

Collecting events from perfLog and removing all of 'TracingStartedInBrowser' events but the first one, error disappears.

paulirish commented 7 years ago

I've seen this error from traces coming from ChromeDriver.

So far the only solution we've determined (incl the chromedriver folks) have been manually stripping events, like @sblancov indicates.

The cleanTrace from lighthouse: https://github.com/GoogleChrome/lighthouse/blob/e9e0e8ef3a0f513dd3335f46dcd15279767ad5d7/lighthouse-core/config/config.js#L29-L110

paulirish commented 7 years ago

Reopening as we should probably handle this situation in this module as well.