Open peet0r opened 2 years ago
Hi @peet0r, Thanks for filing the issue. I am able to reproduce the issue on the latest stable and the master channel. The main thread getting blocked doesn't seem to be reported to the dev tools.
The main thread unbocks at 00:17 and the tap events are executed but the blocked frames are not reported
performance overlay doesn't show the blocking frames
This issue also reproduces with other platforms (verified on Android) But is more easily reproducible with MacOS as it gets blocked for a longer duration as compared to mobile devices.
One thing that I was not clear from the original post: The fps reporting will not catch the blocked main thread because the blocking function does not trigger a redraw. This is logically consistent with the documentation around widget behavior and the performance monitor tooling, but leaves a test coverage gap. Naively, I expected "Performance Monitor" to include detection of a frozen UI thread, but I was assuming a lot and we all know what that leads to...
The current work around for this issue is a "Watchdog" that expects to be reset every 16ms+variance (60fps). The reset function is called via the Ticker
class. This watchdog lives in a separate isolate and records timing statistics to a file for use by CI. There are plans to move this watchdog into our custom embedder, but we wanted to get any insight from the Flutter team/community regarding detection of frozen application UI.
/cc @kenzieschmoll Should this be transferred to flutter/devtools
repo instead ?
Issue :
Overview:
When an application blocks the main thread with a computation heavy operation, the user has a fully frozen screen. When the computation is completed and the main thread is unblocked, the app returns to the normal responsive state (nothing shocking here).
This "unresponsive" state is easy to detect when running/testing the application with a human in the loop. However, when using the provided programmatic testing toolchain, this "unresponsive" state does not trigger any issues on performance tests using the
traceAction
,tracePerformance
or anyTimelineSummary
based diagnostics. This behavior is present in the web based performance tooling and the VSCode tooling as well.Example:
I have a small project outlining my understanding of my issue here.
Things to note: