Skip to content

Exception when running default app on Samsung Galaxy Note 5 #6280

Closed

Description

@raju-bitter

Error message

Seeing a strange behavior for the Galaxy Note 5 only when running the hello world application created by running flutter create. After a reboot of the phone, I can launch the application as expected. But trying to run the same application again for the 2nd time, the app gets stuck at the Flutter Debug Loader screen, with the message: "This is a hot-reload-enabled debug-mode Flutter application...".

The behavior is tied to the hot reload feature, when I disable it by using flutter run --no-hot, everything is working fine on the Galaxy Note 5.

Exception / error message shown: I've seen this exception a couple of times, but that doesn't seem to be the main problem, since the app get's stuck with different error messages as well.

 0 ms • I/flutter : ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
   0 ms • I/flutter : The following ArgumentError was thrown during performLayout():
   0 ms • I/flutter : Invalid argument(s): 0.0

On an Nvidia Shield tablet or Lumigon T3 Android phone everything is working fine. These are the engine and framework revisions:

  • Framework revision 6777766 (57 minutes ago), 2016-10-11 15:51:35
  • Engine revision e8d046e

When running the app as a release using flutter run --release, it launches as expected.

Steps to Reproduce

On a Galaxy Note 5 (Android 6.0.1, build MMB29K.N920SKSU2BPH3), run the following steps:

  1. Reboot the phone
  2. Create a new default app using flutter create helloworld.
  3. Run the app by executing flutter run lib/main.dart or flutter run: Application should run as expected
  4. Stop the app and run again: Application launches with black screen, or with the "Flutter Debug Loader" screen (This is a hot-reload-enabled debug-mode Flutter application...").
  5. Now run the app with hot reload disabled: flutter run --no-hot, and the app will load again.

Logs

flutter run -v output:
Running app after a reboot of device for the first time (everything working fine)
https://gist.github.com/raju-bitter/080e446a570c512133936bbc35e245b0

Running app for second time, now it doesn't launch, stuck at loader screen
https://gist.github.com/raju-bitter/5e978edbf03145715039d7ae2ec193b2

flutter analyze output:

Analyzing lib/main.dart...
No analyzer warnings! (ran in 5.7s)

Flutter Doctor

[✓] Flutter (on Linux, channel master)
    • Flutter at /home/raju/dev/flutter
    • Framework revision 6777766d2d (57 minutes ago), 2016-10-11 15:51:35
    • Engine revision e8d046e9e2
    • Tools Dart version 1.20.0-dev.10.2

[✓] Android toolchain - develop for Android devices (Android SDK 24.0.3)
    • Android SDK at /home/raju/Android/Sdk
    • Platform android-24, build-tools 24.0.3
    • Java(TM) SE Runtime Environment (build 1.8.0_101-b13)

[✓] Atom - a lightweight development environment for Flutter
    • flutter plugin version 0.2.6
    • dartlang plugin version 0.6.40

[-] IntelliJ WebStorm (version 2016.2)
    • Dart plugin not installed; this adds Dart specific functionality.
    • Flutter plugin not installed; this adds Flutter specific functionality.
    • For information about managing plugins, see
      https://www.jetbrains.com/help/idea/2016.2/managing-plugins.html

[✓] Connected devices
    • SM N920S • 05157df5d93b793d • android-arm

Activity

  1. eseidelGoogle commented on Oct 12, 2016

    @eseidelGoogle
    Contributor

    For extra long logs like this gist.github.com can be useful for taking them out-of-band. :)

  2. eseidelGoogle commented on Oct 12, 2016

    @eseidelGoogle
    Contributor

    Looks like the first exception was:

       0 ms • I/flutter : ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
       0 ms • I/flutter : The following ArgumentError was thrown during performLayout():
       0 ms • I/flutter : Invalid argument(s): 0.0
       0 ms • I/flutter : When the exception was thrown, this was the stack:
       0 ms • I/flutter : #0      _Double.clamp (dart:core-patch/double.dart)
       0 ms • I/flutter : #1      TextPainter.layout (package:flutter/src/painting/text_painter.dart)
       0 ms • I/flutter : #2      RenderParagraph.performLayout (package:flutter/src/rendering/paragraph.dart)
       0 ms • I/flutter : #3      RenderObject.layout (package:flutter/src/rendering/object.dart)
    
  3. eseidelGoogle commented on Oct 12, 2016

    @eseidelGoogle
    Contributor

    Presumably that's a bug in TextPainter? @Hixie

  4. raju-bitter commented on Oct 12, 2016

    @raju-bitter
    ContributorAuthor

    Moved the log files into gist.github.com. Updated the description with more details after more testing. Was never able to reproduce that behavior on the two other Android devices I'm testing with.

  5. Hixie commented on Oct 14, 2016

    @Hixie
    Contributor

    @johnmccutchan the updated description suggests maybe hot reload is failing on the note 5?

  6. johnmccutchan commented on Oct 14, 2016

    @johnmccutchan
    Contributor

    @Hixie the DevFS failure in the log is a result of the VM process dying while we are copying files.

    @raju-bitter Do you have any idea what all the filesystem errors (ENOTEMPTY, ENOENT) are coming from? I've never seen that and it appears to be coming from the Android system directly.

  7. johnmccutchan commented on Oct 14, 2016

    @johnmccutchan
    Contributor

    @eseidelGoogle Do we have a Galaxy Note 5?

  8. sethladd commented on Oct 14, 2016

    @sethladd
    Contributor

    We have a Note 3 and a Galaxy S5.

  9. raju-bitter commented on Oct 15, 2016

    @raju-bitter
    ContributorAuthor

    Did a factory rest of Galaxy Note 5 and tried again. Same behavior as before, here are the log files:

    Testing flutter.io on Galaxy Note 5 after factory reset, 1st run of app with one hot reload
    https://gist.github.com/raju-bitter/2dbaf3e5a92b261d6b0aef564c94f00b

    Testing flutter.io on Galaxy Note 5 after factory reset, 2nd of app (error)
    https://gist.github.com/raju-bitter/b3ac3e535cb5cd5e19b421c840c4d547

    The 2nd time I'm running the app, I can see this extra exception:

    Exception from flutter run: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:8102/ws

    https://gist.github.com/raju-bitter/b3ac3e535cb5cd5e19b421c840c4d547#file-flutter-run-log-galaxy-note5-factoryreset-second-run-log-L911

  10. sethladd commented on Oct 17, 2016

    @sethladd
    Contributor

    Thanks for double checking. I'll purchase a Note 5 right now.

    Update: phone ordered. :)

  11. mit-mit commented on Oct 19, 2016

    @mit-mit
    Member

    This also repros if you run a Flutter app from the IntelliJ plugin against a Nexus 5X (but not if you run that same app against that same 5X from a terminal with flutter run): flutter/flutter-intellij#289.

    Some kind of timing issue?

  12. stevemessick commented on Oct 19, 2016

    @stevemessick
    Member

    I can also reproduce this problem on a Nexus 5X using flutter daemon; see my comment in the bug @mit-mit referenced.

  13. johnmccutchan commented on Oct 20, 2016

    @johnmccutchan
    Contributor

    @raju-bitter On the second run the HttpException is caused by the app on the phone crashing. It's unclear why it is crashing, I'm trying to reproduce locally with no luck. Could you gather the full logs from 'adb logcat' ? It might give us a clue about where the crash is occurring.

  14. johnmccutchan commented on Oct 20, 2016

    @johnmccutchan
    Contributor

    Looking at the logs I noticed the first error:

      25 ms • Exception from flutter run: FormatException: Overlong encoding of 0x0
              #0      _Utf8Decoder.convert (dart:convert/utf.dart:499)
              #1      _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:333)
              #2      _Utf8ConversionSink.add (dart:convert/string_conversion.dart:329)
              #3      _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:92)
              #4      _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:119)
              #5      StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135)
              #6      StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206)
              #7      StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135)
              #8      _rootRunUnary (dart:async/zone.dart:1158)
              #9      _CustomZone.runUnary (dart:async/zone.dart:1037)
              #10     _CustomZone.runUnaryGuarded (dart:async/zone.dart:932)
              #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:331)
              #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:258)
              #13     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:768)
              #14     _StreamController._add (dart:async/stream_controller.dart:635)
              #15     _StreamController.add (dart:async/stream_controller.dart:581)
              #16     _Socket._onData (dart:io-patch/socket_patch.dart:1675)
              #17     StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135)
              #18     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206)
              #19     StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135)
              #20     _rootRunUnary (dart:async/zone.dart:1162)
              #21     _CustomZone.runUnary (dart:async/zone.dart:1037)
              #22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:932)
              #23     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:331)
              #24     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:258)
              #25     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:768)
              #26     _StreamController._add (dart:async/stream_controller.dart:635)
              #27     _StreamController.add (dart:async/stream_controller.dart:581)
              #28     _RawSocket._RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1242)
              #29     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:776)
              #30     _microtaskLoop (dart:async/schedule_microtask.dart:41)
              #31     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
              #32     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
              #33     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
    

    It's unclear from the stack trace what is happening but this happens before we even create the DevFS environment.

  15. johnmccutchan commented on Oct 20, 2016

    @johnmccutchan
    Contributor

    @raju-bitter I have made a change to flutter tools that will hopefully give a better stack trace for the above error. Could you sync to the latest master and try again?

  16. raju-bitter commented on Oct 21, 2016

    @raju-bitter
    ContributorAuthor

    @johnmccutchan Did another test run with today's version
    [✓] Flutter (on Mac OS, channel master)
    • Flutter at /Users/raju/dev/flutter
    • Framework revision 729efa2 (12 hours ago), 2016-10-20 23:28:30
    • Engine revision 5e78e75
    • Tools Dart version 1.21.0-dev.0.0

    Here is the complete log after rebooting and launching the Flutter app two times. First time reloading is working. Second time stuck, Flutter exception highlighted:
    https://gist.github.com/raju-bitter/059c12d52cc7557648154d5b5e778e76#file-flutter-run-log-galaxy-note5-factoryreset-better-logging-txt-L1455-L1720

  17. sethladd commented on Oct 21, 2016

    @sethladd
    Contributor

    Thanks! Our Note 5 arrived, and it's on John's desk :)

  18. johnmccutchan commented on Oct 21, 2016

    @johnmccutchan
    Contributor

    I can confirm that I can reproduce the failure as described. It's flaky but I can make it happen.

    Initial investigation points at a low level networking failure between the host machine and the phone. We fail to make the initial service protocol connection. The client receives and HTTP error but the server (running on the phone) never sees the connection attempt. Possibly something bad is happening at the adb level.

  19. self-assigned this
    on Nov 1, 2016
  20. johnmccutchan commented on Nov 1, 2016

    @johnmccutchan
    Contributor

    I've figured out what causes this problem: we get stale device logs and try and use the previous launch's service protocol port.

  21. johnmccutchan commented on Nov 1, 2016

    @johnmccutchan
    Contributor

    After a few attempted runs, I see the following from adb forward --list. Note the repeated device ports.

    1115fbe3a1b01304 tcp:8104 tcp:47374
    1115fbe3a1b01304 tcp:8105 tcp:48964
    1115fbe3a1b01304 tcp:8106 tcp:47374
    1115fbe3a1b01304 tcp:8107 tcp:48964
    1115fbe3a1b01304 tcp:8108 tcp:47374
    1115fbe3a1b01304 tcp:8109 tcp:48964
    1115fbe3a1b01304 tcp:8110 tcp:47374
    1115fbe3a1b01304 tcp:8111 tcp:48964
    1115fbe3a1b01304 tcp:8112 tcp:54910
    1115fbe3a1b01304 tcp:8113 tcp:33898
    1115fbe3a1b01304 tcp:8114 tcp:54910
    1115fbe3a1b01304 tcp:8115 tcp:33898
    
  22. sethladd commented on Nov 1, 2016

    @sethladd
    Contributor

    I've figured out what causes this problem

    Nice! Thanks for tracking it down :)

  23. added a commit that references this issue on Sep 22, 2018
  24. github-actions commented on Sep 5, 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.

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

Metadata

Metadata

Assignees

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