Skip to content

Chrome spawns additional window that must be closed before Flutter web app loads when running in verbose mode #3206

Closed

Description

@nbros

Describe the bug

When starting a Flutter app for the web (either with Chrome or Edge), Dart-Code continuously displays "Compiling lib\main.dart for the Web..." and this message doesn't go away even after a few minutes after the app is running in Chrome/Edge.

Also, and this is probably related, I can not start the Dart DevTools because when I click the corresponding button in the status bar, I get this message instead: "This debug session is not ready yet."

Expected behavior
"Compiling lib\main.dart for the Web..." message disappears when the app finished compiling and is launched.
And be able to start DevTools.

Screenshots

image

Versions

  • VS Code version: 1.54.2
  • Dart extension version: 3.20.1
  • Dart/Flutter SDK version: 2.0.2

Activity

  1. DanTup commented on Mar 15, 2021

    @DanTup
    Member

    Does this happen in a newly created project (using the Flutter: New Application Project command)? Could you try capturing debugging logs while reproducing this?

    • Run the Dart: Capture Debugging Logs command
    • Reproduce the issue
    • Click Cancel on the logging notification to stop logging and open the log
    • Remove anything sensitive from the log
    • Attach the log here (or in a gist)

    Thanks!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Mar 15, 2021
  3. nbros commented on Mar 20, 2021

    @nbros
    Author

    Hello,

    I don't have the same issue today for some reason: I don't see the "Compiling lib\main.dart for the Web..." message anymore when running normally and I can use launch the Dart DevTools.

    But the behavior is different while running Capture Debugging Logs: the app startup in debug stays stuck on "waiting for connection from debug service on Edge/Chrome".

    I also found an issue in my code: I had a call to Platform.isWindows that fails when running on the Web.

    I am still attaching logs in case they can be useful:

    Dart-Code-Log-2021-02-06 10-08-11 stuck waiting for connection from debug service on Edge.txt
    Dart-Code-Log-2021-02-06 10-14-02 stuck waiting for connection from debug service on Chrome.txt

  4. DanTup commented on Mar 22, 2021

    @DanTup
    Member

    But the behavior is different while running Capture Debugging Logs: the app startup in debug stays stuck on "waiting for connection from debug service on Edge/Chrome".

    To make sure I understand correctly - your app appears to work fine now if you're not capturing logs, but hangs when you are capturing logs? Can you reliably reproduce this? Capturing logs shouldn't change any behaviour, so if that's happening it sounds like a significant issue. Are there any errors listed in the VS Code dev tools (Help -> Toggle Developer Tools) when this happens?

    Thanks!

  5. nbros commented on Mar 22, 2021

    @nbros
    Author

    Yes, you understood correctly: the behavior is different when capturing logs, and I could reproduce it.

    When I debug normally, a new profile starts in Chrome and starts loading my application.
    Whereas when I debug while capture logs is enabled, my main profile is used to start a first instance of Chrome but stays on an empty page. Even after waiting for a while, my application does not start in this first instance. But when I close this first instance of Chrome, a second one opens, this time with a new profile, and my application starts loading in this second instance.

    I captured two screencasts showing this:

    Starting debug normally:
    start_debug_normally

    Starting capture logs first then starting debug:
    start_debug_capturing_logs

    Here is all I have in the Developer Tools Console:

    Some messages have been moved to the Issues panel.
    abstractExtensionService.ts:722 [ms-vscode.powershell]: Command `workbench.action.positionPanelLeft` appears multiple times in the `commands` section.
    abstractExtensionService.ts:722 [ms-vscode.powershell]: Command `workbench.action.positionPanelBottom` appears multiple times in the `commands` section.
    DevTools failed to load SourceMap: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/2b9aebd5354a3629c3aba0a5f5df49f43d6689f8/node_modules/windows-process-tree/lib/index.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
    
  6. DanTup commented on Mar 23, 2021

    @DanTup
    Member

    @nbros are you able to provide the full log file for the run that spawns a second chrome (keep it capturing until after the second Chrome spawns). You can email it to me at [email protected] if you don't want to post here.

    I've tried to repro, but it works as expected here. I'm not sure what's going on. The Chrome instances are spawned by Flutter or DWDS, but if it's a bug there it doesn't not explain why capturing logs makes a difference.

    I'd also be interested to know if enabling the log files (instead of using capture logs) triggers the same issue. The relevant logs are:

  7. nbros commented on Mar 24, 2021

    @nbros
    Author

    Hello,

    Here is the log:
    Dart-Code-Log-2021-02-03 18-02-14.txt

    The log naming seems wrong : it got named "2021-02-03" whereas today is 2021-03-24.

  8. nbros commented on Mar 24, 2021

    @nbros
    Author

    I tried adding settings dart.flutterRunLogFile and dart.vmServiceLogFile and I didn't have the issue: the application starts in Chrome or Edge without a first window appearing.

  9. nbros commented on Apr 20, 2021

    @nbros
    Author

    Hello,
    This issue still has the awaiting info tag.
    Do you need additional info?

  10. DanTup commented on Apr 21, 2021

    @DanTup
    Member

    Sorry for the delay, I'm not sure how I missed the previous notifications.

    To make sure I understand correctly, if you use the settings to capture logs, everything is fine. But when using the Dart: Capture Logs command, the app fails to launch correctly (it spawns an additional Chrome window, which when closed, allows the app to continue to launch normally)?

    Could you try creating a .vscode/launch.json file if you don't already have one, and adding the "-v" flag to args and see whether that causes the issue to reproduce (that's the only other difference I think using Capture Logs makes - it forces Verbose mode).

    {
    	"version": "0.2.0",
    	"configurations": [
    		{
    			"name": "Flutter App",
    			"request": "launch",
    			"type": "dart",
    			"args": [
    				"-v"
    			]
    		}
    	]
    }

    If it does reproduce with -v, then please enable the logging settings above and capture a log with verbose mode enabled, and the issue occurring.

    Thanks!

  11. nbros commented on May 4, 2021

    @nbros
    Author

    Hello,

    when using the Dart: Capture Logs command, the app fails to launch correctly (it spawns an additional Chrome window, which when closed, allows the app to continue to launch normally)?

    Yes, exactly

    if you use the settings to capture logs, everything is fine

    No, I reproduced the same issue adding the "-v" flag to args like you suggested.
    So the good news for you is this issue is probably not your fault then 😃
    It looks like an issue with the -v arg in Flutter itself.

  12. DanTup commented on May 4, 2021

    @DanTup
    Member

    It's still possible that the -v flag is producing more output that is breaking things in VS Code. Are you able to get a log using the settings files mentioned above, but using -v? If I understand correctly, the issue is likely to still occur, but you'd be able to capture a log this way? Thanks!

  13. nbros commented on May 4, 2021

    @nbros
    Author

    Here are the logs with -v enabled:
    flutterRunLogFile-debug.txt
    vmServiceLogFile-debug.txt
    (the issue did occur)

  14. DanTup commented on May 7, 2021

    @DanTup
    Member

    The only interesting thing I found in the logs was this:

    [18:08:36]: <== [ +110 ms] <- reset
    [18:08:36]: <== [   +5 ms] C:\dev\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\dev\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root C:\dev\flutter\bin\cache\flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names --experimental-emit-debug-metadata -Dflutter.inspector.structuredErrors=true -DFLUTTER_WEB_AUTO_DETECT=true --output-dill C:\Users\nbros\AppData\Local\Temp\flutter_tools.25786e56\flutter_tool.762a96ed\app.dill --libraries-spec file:///C:/dev/flutter/bin/cache/flutter_web_sdk/libraries.json --packages C:\dev\projects\lamagourmand\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root C:\Users\nbros\AppData\Local\Temp\flutter_tools.25786e56\flutter_tools.9257736c --filesystem-scheme org-dartlang-app --initialize-from-dill build\9da3ff2a5297e0c47025236ff84e71f4.cache.dill.track.dill --platform file:///C:/dev/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill --sound-null-safety
    [18:08:36]: <== [   +4 ms] <- compile org-dartlang-app:/web_entrypoint.dart
    [18:08:55]: <== [{"event":"app.progress","params":{"appId":"9e5d2044-9c49-469e-8877-8e84984b8f90","id":"0","progressId":null,"finished":true}}]
    [18:08:55]: <== [+19084 ms] Synced 32.0MB.
    [18:08:55]: <== [   +1 ms] <- accept
    [18:08:55]: <== [        ] Caching compiled dill
    [18:09:21]: <== [+25607 ms] Using
    [18:09:57]: <== [+36363 ms] [CHROME]:[14384:17192:0504/180957.630:ERROR:token_service_table.cc(140)] Failed to decrypt token for service AccountId-0003BFFDCFA1E13D
    [18:09:57]: <== [  +34 ms] [CHROME]:
    [18:09:57]: <== [        ] [CHROME]:DevTools listening on ws://127.0.0.1:54792/devtools/browser/d5a885af-5752-4852-9392-9b31603d9667
    

    There are two long delays of 25 and 36 seconds around an error message. I'm guessing this occurred around the time the Chrome window spawned that you had to close, though it's not clear if the error was the cause, or it was just delayed for the same issue.

    @grouma any ideas how to debug this further? The issue is that when running on Chrome, a blank Chrome window appears and just does nothing. Closing that window then spawns another window, where the app launches normally. Strangely, it seems to only occur when Flutter is running in verbose mode ("-v").

  15. amr-eniou-3r commented on May 12, 2021

    @amr-eniou-3r

    @DanTup same issue while running web with --profile

    [✓] Flutter (Channel dev, 2.3.0-0.1.pre, on macOS 11.2.3 20D91 darwin-x64, locale en)
        • Flutter version 2.3.0-0.1.pre at /Users/apple/flutter/2.2.0-10.1.pre-dev
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision d72bfb8d07 (2 weeks ago), 2021-04-26 06:05:55 -0700
        • Engine revision de6e1adf97
        • Dart version 2.14.0 (build 2.14.0-18.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/apple/Library/Android/sdk
        • Platform android-30, build-tools 30.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.4, Build version 12D4e
        • CocoaPods version 1.10.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    
    [✓] IntelliJ IDEA Community Edition (version 2020.2.4)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 56.0.2
        • Dart plugin version 202.8488
    
    [✓] VS Code (version 1.56.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.22.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 90.0.4430.212
    
    
  16. amr-eniou-3r commented on May 12, 2021

    @amr-eniou-3r

    @DanTup I created a new Flutter web project and I have the same issue in Vscode profile mode or Intellij

    Until you solve this issue, Is there a workaround I could use to listen to the following URL? no authcode= on it

    [ +1 ms] [CHROME]:DevTools listening on ws://127.0.0.1:50376/devtools/browser/95ce9951-599a-4434-8d45-d6c4f523bd82

    The issue mostly for

    Flutter web profile mode

  17. DanTup commented on May 13, 2021

    @DanTup
    Member

    I think there may be two unrelated issues being described here:

    1. Chrome spawning an additional blank window that must be closed before the app will launch (seems to only occur when running in verbose mode)
    2. VS Code showing "Compiling ..." forever when launching in profile mode

    I can actually reproduce (2) so should be easy to narrow down. To avoid confusion I've opened #3338 for that issue, and will rename this one to cover (1).

  18. changed the title [-]persistent "Compiling lib\main.dart for the Web..." and cannot launch DevTools[/-] [+]Chrome spawns additional window that must be closed before Flutter web app loads when running in verbose mode[/+] on May 13, 2021
  19. DanTup commented on May 13, 2021

    @DanTup
    Member

    @nbros I think your original issue (the extra Chrome window spawning) may have been fixed by flutter/flutter#78386

    It notes:

    Do not run 'chrome --version' in verbose mode on windows.
    It is not supported and causes opening of accumulating
    chrome instances.

    This seems to match up with only occurring in verbose mode too. Can you easily test in Flutter's dev or master channels temporarily to confirm if it's fixed for you there? Thanks!

  20. nbros commented on May 14, 2021

    @nbros
    Author

    Hello,
    I tested on dev and I confirm it works: I didn't have to close a window before my app launched!
    Thanks

  21. DanTup commented on May 17, 2021

    @DanTup
    Member

    Excellent - thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions