Skip to content

"WebSocketChannelException: HttpException: Connection closed before full header was received " with Android emulator #12353

Closed

Description

@JFixby

Exception

Exception: Error connecting to observatory: WebSocketChannelException: WebSocketChannelException: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:8122/ws
#0      throwToolExit (package:flutter_tools/src/base/common.dart:29)
#1      VM.invokeRpcRaw (package:flutter_tools/src/vmservice.dart:738)
<asynchronous suspension>
#2      VM._fetchDirect (package:flutter_tools/src/vmservice.dart:566)
<asynchronous suspension>
#3      ServiceObject.reload (package:flutter_tools/src/vmservice.dart:414)
<asynchronous suspension>
#4      VMService.getVM (package:flutter_tools/src/vmservice.dart:243)
#5      FlutterDevice.getVMs (package:flutter_tools/src/resident_runner.dart:88)
<asynchronous suspension>
#6      ResidentRunner.connectToServiceProtocol (package:flutter_tools/src/resident_runner.dart:584)
<asynchronous suspension>
#7      HotRunner.attach (package:flutter_tools/src/run_hot.dart:106)
<asynchronous suspension>
#8      HotRunner.run (package:flutter_tools/src/run_hot.dart:209)
<asynchronous suspension>
#9      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:345)
<asynchronous suspension>
#10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:241)
<asynchronous suspension>
#11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:181)
<asynchronous suspension>
#12     CommandRunner.runCommand (package:args/command_runner.dart:194)
<asynchronous suspension>
#13     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:279)
<asynchronous suspension>
#14     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
#15     new Future.sync (dart:async/future.dart:222)
#16     CommandRunner.run (package:args/command_runner.dart:109)
#17     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:162)
#18     run.<anonymous closure> (package:flutter_tools/executable.dart:143)
<asynchronous suspension>
#19     AppContext._run (package:flutter_tools/src/base/context.dart:76)
<asynchronous suspension>
#20     AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
#21     _rootRun (dart:async/zone.dart:1120)
#22     _CustomZone.run (dart:async/zone.dart:1001)
#23     runZoned (dart:async/zone.dart:1467)
#24     AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
#25     run (package:flutter_tools/executable.dart:114)
<asynchronous suspension>
#26     main (package:flutter_tools/executable.dart:67)
<asynchronous suspension>
#27     main (file:///home/reyer/reyer/flutter/master/packages/flutter_tools/bin/flutter_tools.dart:16)
#28     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
#29     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

Happens both on unix and windows

Activity

  1. Pacane commented on Oct 2, 2017

    @Pacane
    Contributor

    Would help to have more context.

    flutter doctor, sample code for the use case?

  2. cbracken commented on Oct 2, 2017

    @cbracken
    Member

    Thanks for reporting! As @Pacane mentions, would you be able to provide the following info:

    1. Output of flutter doctor.
    2. Full logs of flutter run --verbose (with whichever other flags you were using at the time)
  3. JFixby commented on Oct 3, 2017

    @JFixby
    Author
    [   +5 ms] Installing build/app/outputs/apk/app.apk...
    [        ] /home/reyer/Android/Sdk/platform-tools/adb -s emulator-5554 install -r build/app/outputs/apk/app.apk
    [+7979 ms] Success
    [        ] /home/reyer/Android/Sdk/platform-tools/adb -s emulator-5554 shell echo -n d7d8bc91c9e9bc47f178dedc92916f571e06c06e > /data/local/tmp/sky.com.daanuu.app.sha1
    [  +16 ms] Android SDK built for x86 startApp
    [   +1 ms] /home/reyer/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true com.daanuu.app/com.daanuu.app.android.AndroidActivity
    [ +336 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.daanuu.app/.android.AndroidActivity (has extras) }
    [        ] Waiting for observatory port to be available...
    [+1003 ms] Diagnostic server URL on device: http://127.0.0.1:52034/
    [   +1 ms] /home/reyer/Android/Sdk/platform-tools/adb -s emulator-5554 forward tcp:8107 tcp:52034
    [   +8 ms] Forwarded host port 8107 to device port 52034 for Diagnostic server
    [   +1 ms] Observatory URL on device: http://127.0.0.1:53109/
    [   +1 ms] /home/reyer/Android/Sdk/platform-tools/adb -s emulator-5554 forward tcp:8106 tcp:53109
    [   +8 ms] Forwarded host port 8106 to device port 53109 for Observatory
    [  +27 ms] Connected to service protocol: http://127.0.0.1:8104/
    [   +2 ms] getVM: {}
    [ +267 ms] getIsolate: {isolateId: isolates/889913824}
    [  +18 ms] _flutter.listViews: {}
    [  +31 ms] Connected to service protocol: http://127.0.0.1:8106/
    [        ] getVM: {}
    Unhandled exception:
    Exception: Error connecting to observatory: WebSocketChannelException: WebSocketChannelException: HttpException: , uri = http://127.0.0.1:8106/ws
    #0      throwToolExit (package:flutter_tools/src/base/common.dart:29)
    #1      VM.invokeRpcRaw (package:flutter_tools/src/vmservice.dart:738)
    <asynchronous suspension>
    #2      VM._fetchDirect (package:flutter_tools/src/vmservice.dart:566)
    <asynchronous suspension>
    #3      ServiceObject.reload (package:flutter_tools/src/vmservice.dart:414)
    <asynchronous suspension>
    #4      VMService.getVM (package:flutter_tools/src/vmservice.dart:243)
    #5      FlutterDevice.getVMs (package:flutter_tools/src/resident_runner.dart:88)
    <asynchronous suspension>
    #6      ResidentRunner.connectToServiceProtocol (package:flutter_tools/src/resident_runner.dart:584)
    <asynchronous suspension>
    #7      HotRunner.attach (package:flutter_tools/src/run_hot.dart:106)
    <asynchronous suspension>
    #8      HotRunner.run (package:flutter_tools/src/run_hot.dart:209)
    <asynchronous suspension>
    #9      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:345)
    <asynchronous suspension>
    #10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:241)
    <asynchronous suspension>
    #11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:181)
    <asynchronous suspension>
    #12     CommandRunner.runCommand (package:args/command_runner.dart:194)
    <asynchronous suspension>
    #13     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:279)
    <asynchronous suspension>
    #14     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
    #15     new Future.sync (dart:async/future.dart:222)
    #16     CommandRunner.run (package:args/command_runner.dart:109)
    #17     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:162)
    #18     run.<anonymous closure> (package:flutter_tools/executable.dart:143)
    <asynchronous suspension>
    #19     AppContext._run (package:flutter_tools/src/base/context.dart:76)
    <asynchronous suspension>
    #20     AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
    #21     _rootRun (dart:async/zone.dart:1120)
    #22     _CustomZone.run (dart:async/zone.dart:1001)
    #23     runZoned (dart:async/zone.dart:1467)
    #24     AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
    #25     run (package:flutter_tools/executable.dart:114)
    <asynchronous suspension>
    #26     main (package:flutter_tools/executable.dart:67)
    <asynchronous suspension>
    #27     main (file:///home/reyer/reyer/flutter/master/packages/flutter_tools/bin/flutter_tools.dart:16)
    #28     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
    #29     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
    
    
  4. JFixby commented on Oct 3, 2017

    @JFixby
    Author
    $ flutter doctor
    [✓] Flutter (on Linux, locale en_US.UTF-8, channel master)
        • Flutter at /home/reyer/reyer/flutter/master
        • Framework revision 0044ea2dbb (34 hours ago), 2017-10-02 00:06:24 -0700
        • Engine revision bdfedcc26f
        • Tools Dart version 1.25.0-dev.11.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
        • Android SDK at /home/reyer/Android/Sdk
        • Platform android-26, build-tools 26.0.2
        • ANDROID_HOME = /home/reyer/Android/Sdk
        • Java binary at: /home/reyer/.local/share/umake/android/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
    
    [✓] Android Studio (version 2.3)
        • Android Studio at /home/reyer/.local/share/umake/android/android-studio
        • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
    
    [✓] IntelliJ IDEA Community Edition (version 2017.2)
        • Flutter plugin version 17.0
        • Dart plugin version 172.4155.35
    
    [✓] Connected devices
        • Android SDK built for x86 • emulator-5558 • android-x86 • Android 7.0 (API 24) (emulator)
        • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
    
  5. Hixie commented on Oct 3, 2017

    @Hixie
    Contributor

    Is this specifically with your application, or with a particular simulator? I would expect to have heard more complaints if this was a wide-spread problem...

  6. added this to the 3: Current Milestone milestone on Oct 3, 2017
  7. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: crashStack traces logged to the console
    and removed on Oct 3, 2017
  8. Hixie commented on Dec 20, 2017

    @Hixie
    Contributor

    @JFixby do you still see this?

  9. modified the milestones: 3: Current Milestone, on Dec 20, 2017
  10. changed the title [-]Current master doesn't work with emulator[/-] [+]"WebSocketChannelException: HttpException: Connection closed before full header was received " with Android emulator[/+] on Dec 20, 2017
  11. JFixby commented on Dec 20, 2017

    @JFixby
    Author

    I think this happens when flutter app crashes right after a start for some reason.

    What is happening:

    • apps starts
    • exits on crash, socket closed
    • starts again
    • the socket returns exception

    So if developer missed this moment (didn't see the crash), it looks to him like:

    • apps starts
    • (...didn't see this part)
    • the socket returns exception

    Logcat is reset by IDEA on the second start, so it has no info in there about the crash.

  12. JFixby commented on Dec 20, 2017

    @JFixby
    Author

    @Hixie actually I don't work with Flutter anymore, so nothing I can help with.

  13. Hixie commented on Dec 21, 2017

    @Hixie
    Contributor

    @JFixby Sorry to hear that, do let me know if there's anything we could improve to help you work with Flutter again in the future. :-)

    cc @devoncarew @mit-mit in case this is something you want to look at from an IDE point of view.

  14. Hixie commented on May 8, 2018

    @Hixie
    Contributor

    Closing as covered by #13379

  15. harshithadev commented on Oct 3, 2020

    @harshithadev

    I'm facing a similar issue

  16. harshithadev commented on Oct 3, 2020

    @harshithadev

    Exception has occurred.
    HttpException (HttpException: Connection closed before full header was received, uri = https://img.pngio.com/free-google-png-images-free-google-imagespng-transparent-images-google-search-png-900_660.png)

    Im trying to add a image using the NetworkImage widget and this keeps poppin up

  17. github-actions commented on Aug 11, 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.

  18. locked as resolved and limited conversation to collaborators on Aug 11, 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

    c: crashStack traces logged to the consoleplatform-androidAndroid applications specificallyt: hot reloadReloading code during "flutter run"toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions