Repository navigation
Track widget builds is broken #101379
Description
I noticed this today when working off of Flutter 2.12.0-4.1.pre but this is reproducible on master (2.13.0-0.0.pre.386), too.
With track widget builds enabled, there appears to be an extra begin ("ph":"B") BUILD event (or sometimes more than one) that does not have a corresponding end timeline event ("ph":"E"). This results in an out of balance event tree that DevTools cannot render. I'm going to look to see if we can add some graceful handling for this in DevTools, but there is likely a spot in the framework where we are not ending a timeline event that we should fix.
In the attached json file (you'll have to remove the .txt extension to turn it back to json), the problem BUILD event is near the top of the file and is separated from the rest of the json by a few new lines. Without this event, the timeline events will render as expected in DevTools. Near the end of the json file, there is another small group events separated by new lines. We would have expected the end BUILD event to come in somewhere between "FINALIZE TREE" and "Engine::BeginFrame", but it is missing. If you add this stubbed event before "Engine::BeginFrame", the timeline events will render as expected in DevTools: {"name":"BUILD","cat":"Dart","tid":42243,"pid":48755,"ts":67688975310,"tts":3618953,"ph":"E","args":{}},
Activity
kenzieschmoll commentedon Apr 5, 2022
I have a band-aid fix for the DevTools side of this here: flutter/devtools#3960. We will recover gracefully from bad data like this once that PR lands, but the end time for the missing event will be inferred and inaccurate, so we still need to fix this data issue on the framework side.
darshankawar commentedon Apr 6, 2022
Labeling for further tracking.
goderbauer commentedon Apr 6, 2022
@jacob314 Do you maybe have any insights into this? (Or know somebody who could look at this?)
kenzieschmoll commentedon Apr 7, 2022
I expect we are missing a call to
Timeline.finishSync();somewhere, or otherwise just not reaching it. The 'BUILD' timeline event is started here:flutter/packages/flutter/lib/src/widgets/framework.dart
Line 2579 in 35b18ba
framework.dartin that PR.Hixie commentedon Apr 10, 2022
There's been lots of changes to this code since then. Simplest way to figure out the offending PR is to bisect.
Hixie commentedon Apr 10, 2022
This should arguably be P1 / stop ship. cc @itsjustkevin
6 remaining items
jason-simmons commentedon Apr 12, 2022
This started with 61ac285
The reproduction steps above flow through the
return updatedChild!code path inElement.inflateWidget, resulting in aTimeline.startSyncthat was not matched by aTimeline.finishSyncgoderbauer commentedon Apr 13, 2022
We should cherrypick the fix into the next release.
jason-simmons commentedon Apr 13, 2022
Filed a cherry pick request: #101867
github-actions commentedon Apr 28, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.