Issue 1:
Steps to Reproduce

This error is happening for me on every app I run on my physical device. The app builds and starts running, but then loses the connection between the console and the phone.

Logs

These logs are from the flutter_gallery app:

[ +203 ms] Error connecting to the service protocol: WebSocketChannelException: WebSocketChannelException: HttpException: , uri = http://127.0.0.1:8106/ws
[ +3 ms] "flutter run" took 87,076ms.

#0 throwToolExit (package:flutter_tools/src/base/common.dart:28)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:341)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:256)
<asynchronous suspension>
#3 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:196)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:194)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:279)
<asynchronous suspension>
#6 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
#7 new Future.sync (dart:async/future.dart:222)
#8 CommandRunner.run (package:args/command_runner.dart:109)
#9 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:162)
#10 run.<anonymous closure> (package:flutter_tools/runner.dart:89)
<asynchronous suspension>
#11 AppContext._run (package:flutter_tools/src/base/context.dart:76)
<asynchronous suspension>
#12 AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
#13 _rootRun (dart:async/zone.dart:1120)
#14 _CustomZone.run (dart:async/zone.dart:1001)
#15 runZoned (dart:async/zone.dart:1467)
#16 AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
#17 run (package:flutter_tools/runner.dart:60)
<asynchronous suspension>
#18 main (package:flutter_tools/executable.dart:44)
<asynchronous suspension>
#19 main (file:///Users/frederickcook/flutter/packages/flutter_tools/bin/flutter_tools.dart:16)
#20 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
#21 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

[ +171 ms] ensureAnalyticsSent: 155ms
[ +5 ms] Invalid VMService message data detected: {jsonrpc: 2.0, method: _registerService, params: {service: reloadSources, alias: Flutter Tools}}

Full build log: https://firebasestorage.googleapis.com/v0/b/messaging-testing.appspot.com/o/bugreport.zip?alt=media&token=c45d116d-6a32-464d-b4a8-5e5b0a73a150

Flutter Doctor

Frederick-Cook-Air% flutter doctor

[✓] Flutter (on Mac OS X 10.13.2 17C88, locale en-US, channel master)
• Flutter at /Users/frederickcook/flutter
• Framework revision 370c73d9bc (2 hours ago), 2017-12-21 15:02:35 -0800
• Engine revision 00e9b362d5
• Tools Dart version 1.25.0-dev.11.0
• Engine Dart version 2.0.0-edge.075720c352685b6c4fbfa3b6300b270714562f62

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.0)
• Android SDK at /Users/frederickcook/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-26, build-tools 26.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.3.1

[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.2.6)
• Flutter plugin version 19.1
• Dart plugin version 172.4343.25

[✓] Connected devices
• Frederick Cook’s iPhone • c181836da6febb49dcdbea495dea15b137def3cd • ios • iOS 11.2.1
• iPhone 7 Plus • 379327B7-2EFA-45F3-AF2F-828F0BB5458A • ios • iOS 11.2 (simulator)

Issue 2:
E.g. https://flutter-dashboard.appspot.com/api/get-log?ownerKey=ahNzfmZsdXR0ZXItZGFzaGJvYXJkclgLEglDaGVja2xpc3QiOGZsdXR0ZXIvZmx1dHRlci82OGJmNGIzYzYyZjM3NmJkNWZjNTE3ZTkzYzA3ZDJhNDg1YzRjMTJmDAsSBFRhc2sYgICAgICAoAoM

Log excerpt:

stdout: [ ] [ 49%] Copying /Users/mac4/.cocoon/flutter/examples/flutter_gallery/build/ios/iphoneos/Runner.app/PkgInfo to device
stdout: [ ] [ 49%] Copying /Users/mac4/.cocoon/flutter/examples/flutter_gallery/build/ios/iphoneos/Runner.app/Runner to device
stdout: [ +602 ms] [ 52%] CreatingStagingDirectory
stdout: [ ] [ 57%] ExtractingPackage
stdout: [ ] [ 60%] InspectingPackage
stdout: [ +27 ms] [ 60%] TakingInstallLock
stdout: [ +19 ms] [ 65%] PreflightingApplication
stdout: [ +38 ms] [ 65%] InstallingEmbeddedProfile
stdout: [ +51 ms] [ 70%] VerifyingApplication
stdout: [ +485 ms] [ 75%] CreatingContainer
stdout: [ +13 ms] [ 80%] InstallingApplication
stdout: [ +5 ms] [ 85%] PostflightingApplication
stdout: [ +3 ms] [ 90%] SandboxingApplication
stdout: [ +24 ms] [ 95%] GeneratingApplicationMap
stdout: [ +82 ms] [100%] Installed package build/ios/iphoneos/Runner.app
stdout: [ +374 ms] ------ Debug phase ------
stdout: [ ] Starting debug of iPhone 6 (GSM) 'Emily Fortuna’s iPhone' (f2943620b1e218437e4014a75d136d5121f199d9) connected through USB...
stdout: [ +429 ms] [ 0%] Looking up developer disk image
stdout: [+1083 ms] [ 90%] Mounting developer disk image
stdout: [ +116 ms] [ 95%] Developer disk image already mounted
stdout: [ +767 ms] [100%] Connecting to remote debug server
stdout: [ ] -------------------------
stdout: [ +171 ms] (lldb) command source -s 0 '/tmp/CFA78A83-12C3-487E-9FD1-2DDF7DCCE9EA/fruitstrap-lldb-prep-cmds-f2943620b1e218437e4014a75d136d5121f199d9'
stdout: [ ] Executing commands in '/tmp/CFA78A83-12C3-487E-9FD1-2DDF7DCCE9EA/fruitstrap-lldb-prep-cmds-f2943620b1e218437e4014a75d136d5121f199d9'.
stdout: [ ] (lldb) platform select remote-ios --sysroot '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.3/Symbols'
stdout: [ ] Platform: remote-ios
stdout: [ ] Connected: no
stdout: [ ] SDK Path: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.3/Symbols"
stdout: [ ] (lldb) target create "/Users/mac4/.cocoon/flutter/examples/flutter_gallery/build/ios/iphoneos/Runner.app"
stdout: [ +957 ms] Current executable set to '/Users/mac4/.cocoon/flutter/examples/flutter_gallery/build/ios/iphoneos/Runner.app' (arm64).
stdout: [ ] (lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/3C5E5390-31C2-4A55-801F-A0EED38C8EF7/Runner.app"
stdout: [ +1 ms] (lldb) script fruitstrap_connect_url="connect://127.0.0.1:55426"
stdout: [ ] (lldb) command script import "/tmp/CFA78A83-12C3-487E-9FD1-2DDF7DCCE9EA/fruitstrap_f2943620b1e218437e4014a75d136d5121f199d9.py"
stdout: [ +18 ms] (lldb) command script add -f fruitstrap_f2943620b1e218437e4014a75d136d5121f199d9.connect_command connect
stdout: [ ] (lldb) command script add -s asynchronous -f fruitstrap_f2943620b1e218437e4014a75d136d5121f199d9.run_command run
stdout: [ ] (lldb) command script add -s asynchronous -f fruitstrap_f2943620b1e218437e4014a75d136d5121f199d9.autoexit_command autoexit
stdout: [ ] (lldb) command script add -s asynchronous -f fruitstrap_f2943620b1e218437e4014a75d136d5121f199d9.safequit_command safequit
stdout: [ ] (lldb) connect
stdout: [ +38 ms] (lldb) run
stdout: [ +489 ms] success
stdout: [ ] (lldb) safequit
stdout: [ +126 ms] Process 15196 detached
stdout: [ +10 ms] Application launched on the device. Waiting for observatory port.
stdout: [ +732 ms] Observatory URL on device: http://127.0.0.1:52200/
stdout: [ +6 ms] /usr/local/bin/iproxy 8100 52200 f2943620b1e218437e4014a75d136d5121f199d9
stdout: [ +3 ms] Forwarded port ForwardedPort HOST:8100 to DEVICE:52200
stdout: [ ] Forwarded host port 8100 to device port 52200 for Observatory
stdout: [ +2 ms] Connecting to service protocol: http://127.0.0.1:8100/
stdout: [ +55 ms] "flutter run" took 69,704ms.
stderr:
stderr: WebSocketChannelException: WebSocketChannelException: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 55428
stderr: #0 new IOWebSocketChannel._withoutSocket. (package:web_socket_channel/io.dart:83)
stderr: #1 _invokeErrorHandler (dart:async/async_error.dart:13)
stderr: #2 _HandleErrorStream._handleError (dart:async/stream_pipe.dart:286)
stderr: #3 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:168)
stderr: #4 _rootRunBinary (dart:async/zone.dart:1140)
stderr: #5 _CustomZone.runBinary (dart:async/zone.dart:1023)
stderr: #6 _CustomZone.runBinaryGuarded (dart:async/zone.dart:917)
stderr: #7 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:350)
stderr: #8 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:368)
stderr: #9 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:266)
stderr: #10 _StreamController&&_SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:800)
stderr: #11 _StreamController._addError (dart:async/stream_controller.dart:675)
stderr: #12 _rootRunBinary (dart:async/zone.dart:1140)
stderr: #13 _CustomZone.runBinary (dart:async/zone.dart:1023)
stderr: #14 _CustomZone.runBinaryGuarded (dart:async/zone.dart:917)
stderr: #15 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:350)
stderr: #16 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:368)
stderr: #17 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:266)
stderr: #18 _StreamController&&_SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:800)
stderr: #19 _StreamController._addError (dart:async/stream_controller.dart:675)
stderr: #20 new Stream.fromFuture. (dart:async/stream.dart:110)
stderr: #21 _rootRunBinary (dart:async/zone.dart:1140)
stderr: #22 _CustomZone.runBinary (dart:async/zone.dart:1023)
stderr: #23 _FutureListener.handleError (dart:async/future_impl.dart:142)
stderr: #24 _Future._propagateToListeners.handleError (dart:async/future_impl.dart:648)
stderr: #25 _Future._propagateToListeners (dart:async/future_impl.dart:669)
stderr: #26 _Future._completeError (dart:async/future_impl.dart:486)
stderr: #27 _Future._asyncCompleteError. (dart:async/future_impl.dart:536)
stderr: #28 _rootRun (dart:async/zone.dart:1120)
stderr: #29 _CustomZone.run (dart:async/zone.dart:1001)
stderr: #30 _CustomZone.bindCallback. (dart:async/zone.dart:928)
stderr: #31 _microtaskLoop (dart:async/schedule_microtask.dart:41)
stderr: #32 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
stderr: #33 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
stderr: #34 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)
stderr:
stdout: [ +7 ms] exiting with code 1
exitcode: 1
Task failed: Executable failed with exit code 1.

Stack trace:
package:flutter_devicelab/framework/utils.dart 77:3 fail
package:flutter_devicelab/framework/utils.dart 257:5 exec
===== asynchronous gap ===========================
dart:async _Completer.completeError
package:flutter_devicelab/framework/utils.dart 260:1 exec
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:flutter_devicelab/framework/utils.dart 235:10 exec
package:flutter_devicelab/framework/utils.dart 305:10 flutter
package:flutter_devicelab/tasks/perf_tests.dart 117:13 StartupTest.run.
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:flutter_devicelab/tasks/perf_tests.dart 110:54 StartupTest.run.
package:flutter_devicelab/framework/utils.dart 329:24 inDirectory
===== asynchronous gap ===========================
dart:async new Future.microtask
package:flutter_devicelab/framework/utils.dart 325:80 inDirectory
package:flutter_devicelab/tasks/perf_tests.dart 110:18 StartupTest.run
===== asynchronous gap ===========================
dart:async new Future.microtask
package:flutter_devicelab/tasks/perf_tests.dart 109:34 StartupTest.run
package:flutter_devicelab/framework/framework.dart 125:36 _TaskRunner._performTask.
===== asynchronous gap ===========================
dart:async new Future.microtask
package:flutter_devicelab/framework/framework.dart 124:28 _TaskRunner._performTask.
package:stack_trace Chain.capture
package:flutter_devicelab/framework/framework.dart 124:11 _TaskRunner._performTask
package:flutter_devicelab/framework/framework.dart 84:39 _TaskRunner.run

Task failed with the following reason:
Task failed: Executable failed with exit code 1.