Skip to content

TimeoutException with hot reload. Hot restart works fine #17005

Closed

Description

@zoechi

Steps to Reproduce

When I click the hot reload button in IntelliJ I get timeouts most of the time. I stick with hot restart which works fine.

I have this issue since a while and don't know with what version it started (didn't much UI work until recently)

Logs

Run your application with flutter run and attach all the log output.

Run flutter analyze and attach any output of that command also.

Flutter Doctor

[✓] Flutter (Channel dev, v0.3.5, on Mac OS X 10.13.4 17E199, locale en-AT)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.2)
[✓] Connected devices (1 available)

IntelliJ 2018.1.2 with Flutter plugin 23.2.3.

For more information about diagnosing and reporting Flutter bugs, please see https://flutter.io/bug-reports/.

Activity

  1. mraleph commented on Apr 26, 2018

    @mraleph
    Member

    @aam @rmacnak-google @a-siva - can we think about any sort of logging we could add to diagnose this problem? I think in the original comment @zoechi was pasting logs which indicated that _listViews is timing out.

  2. aam commented on Apr 26, 2018

    @aam
    Member

    There is known issue where hot-reload hangs if the Flutter code is sitting on the breakpoint.
    We had flutter-team-archive/engine#4939 to fix that, but landing of it had to wait to unblock engine refactor land.

  3. mraleph commented on Apr 26, 2018

    @mraleph
    Member

    @zoechi could you check if you are on the breakpoint when reload times out?

  4. zoechi commented on Apr 27, 2018

    @zoechi
    ContributorAuthor

    This also happens when no breakpoint is set.

  5. zoechi commented on May 8, 2018

    @zoechi
    ContributorAuthor

    There are also #7310 and #17372 which seem related but they do look like being caused by breakpoints.

  6. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    Still experiencing this problem on latest master 0.4.5-pre.6
    Last time I clearly didn't experience this was on beta pointing to v 0.2.8. I can still roll back to that version and everything goes smooth.

    I tried different versions of Android Studio, also latest Intellij, forcing eiter dart 1 or 2, in different projects and flutter versions. Nothing makes it better, usually the first 1 or 2 hot reloads work normally but after about a minute all attempts to hot reload from IDE never finishes. Attempts to hot reload from command line seem to "finish" but no side effects are shown on emulator.

    I avoid breakpoints as much as I can in general, until hot reload is 100% back.

    Is there any way to mitigate it?

  7. a-siva commented on May 15, 2018

    @a-siva
    Contributor

    can you add the '--verbose' option to the 'flutter run' command and post the output here.

  8. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    Android Studio 3.1.1 • Flutter plugin io.flutter 24.0.1 • Dart plugin 173.4700

    Flutter 0.3.2 • channel beta • https://github.com/flutter/flutter.git
    Framework • revision 44b7e7d3f4 (4 weeks ago) • 2018-04-20 01:02:44 -0700
    Engine • revision 09d05a3891
    Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b
    

    Things I tried on flutter beta 0.3.2 today:

    • Ran from command line with --verbose. Hot reload works as expected.
    • flutter clean. Ran from command line without --verbose. Hot reload works as expected.
    • flutter clean. Ran debug from AS 3.1.1 with shortcut assigned to hot reload, no verbose logging. Hot reload stuck, console window shows "Performing hot reload..." and never goes past it.

    The test was the following:

    • Have new Text('abc');
    • Add one more letter to that string, in a way that across all tests that string is still unique. Hot reload.
    • Repeat step above 5 times.
    • Delete last letter. Hot reload.
    • Repeat step above 5 times.

    My experience varies, but usually when Android Studio I can add about 2 or 3 characters.

    In this test the command line showed to be reliable, but in a typical use I also have problems with it.

    https://gist.github.com/fmatosqg/7a643451d39a760464b8b64ea9019ca8

    These are the lines immediately before the timeout manifests itself:

    [   +3 ms] Compiling dart to kernel with 1 updated files
    [ +110 ms] Updating files
    [   +7 ms] DevFS: Sync finished
    [        ] Synced 0.0MB.
    [        ] _reloadSources: {pause: true, rootLibUri: /data/user/0/au.com.safescripts.chemist/cache/safescript_chemistDBIBEA/safescript_chemist/lib/main.dart.dill, packagesUri: /data/user/0/au.com.safescripts.chemist/cache/safescript_chemistDBIBEA/safescript_chemist/.packages, isolateId: isolates/674528656}
    [  +79 ms] reloaded 8 of 403 libraries
    [        ] Sending reload events to Android SDK built for x86
    [        ] Sending reload event to "main.dart$main-674528656"
    [        ] getIsolate: {isolateId: isolates/674528656}
    [  +13 ms] _flutter.listViews: {}
    [+60005 ms] Request to Dart VM Service timed out: _flutter.listViews({})
    [{"event":"app.progress","params":{"appId":"1ff2ccda-52ee-438e-b064-4c7f6785a7f5","id":"10","progressId":"hot.reload","finished":true}}]
    [{"id":9,"error":"TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})"}]
    

    After that I hit stop, that is clearly indicated in the gist.

  9. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    A few more details:

    • I can consistently reproduce the problem in a private project, but never on a specific codelab (https://github.com/material-components/material-components-flutter-codelabs.git branch 103-starter_and_102-complete) even after git clean -xffd
    • I noticed from the gist that the emulator says its memory is full, so I reran it after deleting a couple of apps.
    • The emulator is not responsive: app bar, TextField, button don't show any signs that I'm interacting with them
    • SW back button (emulator) gives me visual feedback but nothing in app shows it received that command
    • qemu is typically 7% when idle either on home or with flutter app opened, but raises to 29-30% when hot reload is stuck.
    • If I take too long to type / hot reload I can have fewer successfull cycles (as in, less characters show). But if I do it too fast it also makes more problems.
    • I can still press home button, then recent button and swipe the app to kill it, when AS buttons go back to normal (stop button grays out, debut and run buttons get enabled again).
  10. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    A few more details that seem to make a difference but I still can't be sure:

    Having a small Scaffold with a single element and triggering hot reload with cmd+s (save file) seems to work better than

    a relatively big tree, using the shortcut for hot reload and changing content in a nested text like so:

    new Text(
                       'text',
                       style: textTheme.body1,
                     ),
    
  11. aam commented on May 15, 2018

    @aam
    Member

    Perhaps we can consolidate this into #17434 where folks are reporting similar problem with hot reload in VSCode.

  12. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    Moving my discoveries over that thread (#17434 )

  13. zoechi commented on May 18, 2018

    @zoechi
    ContributorAuthor

    It seems it depends on what part of the UI is shown.
    I started working on a simpler page and here hot-reload is working fine, but on a more complex page it still "_listViews is timing out."

  14. mraleph commented on May 18, 2018

    @mraleph
    Member

    As far as I see @aam is working on fixing #17434 which looks similar.

    Alex, is this the same issue or are they different issues? Should these two bugs be merged?

  15. aam commented on May 18, 2018

    @aam
    Member

    Merging with #17434

  16. github-actions commented on Sep 3, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions