Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against negative timestamps in trace processor (prev: screenshots track crashes when opening trace in UI) #660

Open
cphlipot1 opened this issue Dec 5, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@cphlipot1
Copy link
Contributor

image

I'm seeing the screenshots track crash when opening a trace in the UI despite my trace having no screenshots.

I've created a simplified synthetic trace with 9 packets to reproduce this issue, which i believe should still be a valid trace despite being manually constructed: crashing_trace.pftrace.zip

How to reproduce

  1. open ui.perfetto.dev
  2. open crashing_trace.pftrace
  3. once trace loads expand all tracks (there should be two total)
  4. zoom all the way out (hold 's' key)
  5. observe error
To assist with debugging please attach or link to the trace you were viewing.

Viewed on: https://ui.perfetto.dev

Error: Normalization error CacheKey<0, 28521267200, 4194304, 1700> CacheKey<-893376998, 22334424944, 7030206, 1652>
Error: Normalization error CacheKey<0, 28521267200, 4194304, 1700> CacheKey<-893376998, 22334424944, 7030206, 1652>
    at ScreenshotsTrack.maybeRequestData (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:323008:21)
    at ScreenshotsTrack.renderCanvas (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:322733:20)
    at ScreenshotsTrack.render (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:322301:15)
    at TrackPanel.renderCanvas (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:321774:25)
    at PanelContainer.redrawCanvas (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:473569:26)
    at onRedraw (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:473384:38)
    at RafScheduler.syncCanvasRedraw (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:318683:14)
    at https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:318717:60
    at measure (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:318469:7)
    at RafScheduler.onAnimationFrame (https://ui.perfetto.dev/v39.0-bb663f9c4/frontend_bundle.js:318717:48)

v39.0-bb663f9c4 bb663f9c401914d29e1207171e8a37f410cf5dd2
UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
@LalitMaganti
Copy link
Collaborator

Had a look at your trace: I think the problem is actually this trace is not well formed. Specifically we have the following situation:

  1. Clock 6 and 3 are synchronized at ts = 0 <-> ts = 0
  2. Clock 3 is synchronized at 26366605614 to Clock 9999 at 2875714123178517
  3. The first event is emitted on clock 9999 at 2875665408788047. This is converted to clock 3 at -22347784856 and onto clock 6 also at -22347784856.

Negative timestamps are not supported in trace processor (i.e. producing them is undefined behaviour): this is why the UI is crashing. We should likely have some checks against this in trace processor.

@LalitMaganti LalitMaganti added the good first issue Good for newcomers label Dec 5, 2023
@LalitMaganti LalitMaganti changed the title screenshots track crashes when opening trace in UI Guard against negative timestamps in trace processor (prev: screenshots track crashes when opening trace in UI) Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants