Skip to content

"Request to Dart VM Service timed out: _flutter.listViews({})" during hot reload #17434

Closed

Description

@iampawan

Flutter version - 0.4.3-pre.16 & Dart Code - 2.12.2
@DanTup TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})

flutter_run.txt
observatory.txt

Activity

  1. changed the title [-]App Freezes While Performing Hot Reload In VSCODE . [/-] [+]TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})[/+] on May 10, 2018
  2. changed the title [-]TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})[/-] [+]"Request to Dart VM Service timed out: _flutter.listViews({})" during hot reload[/+] on May 10, 2018
  3. DanTup commented on May 10, 2018

    @DanTup
    Contributor

    Does hot reload always work the first time, and then fail on subsequent attempts?

    In these logs, the first one works (which said "Initializing hot reload") but the next one failed (and it instead said "Performing hot reload..."). I'm not sure if there's a difference in what's performed the first time versus others.

    [5:34:17 PM]: ==> [{"id":"7","method":"app.restart","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","fullRestart":false,"pause":true}}]
    [5:34:17 PM]: <== [{"event":"app.progress","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","id":"5","progressId":"hot.reload","message":"Initializing hot reload..."}}]
    [5:34:18 PM]: <== [{"event":"app.progress","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","id":"5","progressId":"hot.reload","finished":true}}]
    [5:34:18 PM]: <== Reloaded 3 of 395 libraries in 1,239ms.
    [5:34:18 PM]: <== [{"id":"7","result":{"code":0,"message":"Reloaded 3 of 395 libraries"}}]
    [5:34:24 PM]: ==> [{"id":"8","method":"app.restart","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","fullRestart":false,"pause":true}}]
    [5:34:24 PM]: <== [{"event":"app.progress","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","id":"6","progressId":"hot.reload","message":"Performing hot reload..."}}]
    [5:35:25 PM]: <== [{"event":"app.progress","params":{"appId":"cd36a340-0ea8-4cd4-80f8-158e72380363","id":"6","progressId":"hot.reload","finished":true}}]
    [5:35:25 PM]: <== [{"id":"8","error":"TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})"}]
    
  4. iampawan commented on May 10, 2018

    @iampawan
    Author
  5. darioielardi commented on May 10, 2018

    @darioielardi

    same issue here

  6. DanTup commented on May 10, 2018

    @DanTup
    Contributor

    Looking at the logs again; we never got a response to the resume request on the second hot reload.. The log ends here:

    [5:34:25 PM]: ==> {"id":"414","method":"resume","params":{"isolateId":"isolates/61399362"}}
    
  7. devoncarew commented on May 10, 2018

    @devoncarew
    Contributor

    @aam @rmacnak-google, we've had issues in the past re: _flutter.listViews({}) and the VM being paused. There's some code in flutter_tools to avoid listing views if it thinks the VM is paused. That code is likely a bit racy however. We may want to consider moving to maintaining the list of views on the flutter_tools side, and adding and removing from the list based on flutter view added / flutter view removed events from the target device.

  8. zoechi commented on May 10, 2018

    @zoechi
    Contributor

    I had this consistently for some weeks but seems to be working now in dev channel.

    Update
    It happens less frequently, but still happens.

  9. DanTup commented on May 10, 2018

    @DanTup
    Contributor

    @zoechi Was that in IntelliJ? We were just discussing whether it might be a timing issue and Dart Code doing something differently to IntelliJ; but maybe it happens there too. Do you normally run with or without the debugger?

  10. zoechi commented on May 10, 2018

    @zoechi
    Contributor

    Yes IntelliJ. Always with debugger.

  11. DanTup commented on May 10, 2018

    @DanTup
    Contributor

    @devoncarew I diff'd the good/bad restarts from the log above and the requests are all in the same order (obviously there may be timing variances), though the bad one never got a response to the resume.

    screen shot 2018-05-10 at 5 02 00 pm

    I'm not sure how much we can do to change the timing (short of putting little delays in places).

    Currently it looks like we wait for PausePostRequest, then we send requests to remove and re-add all breakpoints, then once they're all done, we send the resume.

  12. devoncarew commented on May 10, 2018

    @devoncarew
    Contributor

    Currently it looks like we wait for PausePostRequest, then we send requests to remove and re-add all breakpoints, then once they're all done, we send the resume.

    OK, this matches what we're doing in IntelliJ; thanks for investigating.

  13. joon610 commented on May 11, 2018

    @joon610

    same issue~~....

  14. iampawan commented on May 13, 2018

    @iampawan
    Author

    Any update on this issue @DanTup ?

  15. DanTup commented on May 14, 2018

    @DanTup
    Contributor

    I'm afraid this one is currently a little outside of my knowledge so is going to need some input from someone else. As a temporary workaround you could run from the terminal (though this means no debugger) or disable hot-reload-on-save and use Ctrl+F5 for full restarts (they're still pretty fast, but obviously lose state/position in app).

  16. 15 remaining items

  17. aam commented on May 15, 2018

    @aam
    Member

    @DanTup, apologies, no, I don't believe so now. You do want to pause and resend breakpoints since the code might have moved as part of the hot reload. So yes, that is how you could end up in the same non-responsive engine state even if your code was not paused on the breakpoint when you did hot reload.
    I'm working on a fix for this.

  18. DanTup commented on May 15, 2018

    @DanTup
    Contributor

    @aam Great; thanks!

  19. fmatosqg commented on May 15, 2018

    @fmatosqg
    Contributor

    after reading about breakpoints on this issue I started fiddling with them and got VERY different results.

    This is how I fiddled:

    image

    The sequence I did was roughly the following:

    1. disable 'break on exceptions'
    2. Add characters one by one to new Text(''), with dart 2 enabled on AS.
    3. hot reload
    4. repeat sequence about 10 times
    5. enable 'break on exceptions'
    6. do steps 2 - 4. On 7th attempt it chocked and presented the usual problem
    7. stop app, disable 'break on exceptions'
    8. create a new new Text(''), launch app again
    9. repeat steps 2 - 4
    10. do step 5 (enable exceptions again)
    11. repeat steps 2 - 4

    Now I can't make this project hang at all. Next time it does I'll fiddle again with breakpoints.

    Note: I usually disable all breakpoints and have none intentionally added, until this hot reload solves itself.

    My logs and setup details were added in #17005 (comment). before this breakpoint fiddling. The only difference now is that I downloaded and launched an emulator based on nexus 5X with Android P, but I could reproduce the problems very easily there yesterday after taking such logs.

  20. rodydavis commented on May 16, 2018

    @rodydavis
    Contributor

    Something changed on my setup too in VSCode, I installed the Offical flutter extension in addition to the dart on that was already installed. I would see if it has break on uncaught exceptions enabled by default...

  21. DanTup commented on May 16, 2018

    @DanTup
    Contributor

    Something changed on my setup too in VSCode, I installed the Offical flutter extension in addition to the dart on that was already installed

    This won't make any difference; at this point all of the debugging comes from the Dart extension (the Flutter extension has a dependency on the Dart one, so if you didn't already have it it would install it for you).

    I would see if it has break on uncaught exceptions enabled by default...

    It's not on by default (it's a tickbox at the bottom left of the debug sidebar). I wouldn't expect this setting to affect the ability for us to resume, but I'm not familiar with what's happening in the VM-side.

    That said, from the comment above, I think may @aam may have figured out the issue now :-)

  22. joon610 commented on May 16, 2018

    @joon610

    re install other version.. and then done~

  23. fmatosqg commented on May 17, 2018

    @fmatosqg
    Contributor

    I think I can find an effective workaround the problem.

    • Today I opened pre-existing project
    • 1st hot reload failed when editing string on text
    • stopped, started app, changed string, 1st hot reload failed again. That happened 3x
    • opened breakpoints menu, disabled all of them
    • hot reload works like magic
    • enable same breakpoints as before
    • hot reload still working as expected. I can't figure out how to make it fail again.

    These are the details:

    • Different emulator since last time ( nexus 5x api 26, downloaded about 3 months ago )
    • Updated flutter intellij plugin from 24 to 24.0.1 since last report
    > flutter --version
    Flutter 0.4.5-pre.6 • channel master • https://github.com/flutter/flutter.git
    Framework • revision a25bbc7bfc (2 days ago) • 2018-05-14 15:51:12 -0700
    Engine • revision 06afdfe54e
    Tools • Dart 2.0.0-dev.54.0.flutter-46ab040e58
    

    image

  24. aam commented on May 18, 2018

    @aam
    Member

    The intended fix for this landed in 89cb5d2 . If folks could give it a try(get latest flutter from master channel/branch) and confirm, that would be awesome!

  25. ThinkDigitalSoftware commented on May 20, 2018

    @ThinkDigitalSoftware
    Contributor

    @aam, Works great! Even when on breakpoints while paused. Nice! Thank you!

  26. aam commented on May 21, 2018

    @aam
    Member

    Thank you for confirmation, @ThinkDigitalRepair !

  27. 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.

  28. 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