flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.19k stars 27.49k forks source link

old versions of libusbmuxd and libimobiledevice cause failure with "Overlong encoding" #29178

Closed JoeyHengst closed 4 years ago

JoeyHengst commented 5 years ago

Occasionally flutter seems to crash.

VSCode on mac.

flutter doctor -v also crashes with the following:

[✓] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-US)
    • Flutter version 1.2.1 at /Users/joeyhengst/flutter
    • Framework revision 8661d8aecd (4 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

⣽Unhandled exception:
FormatException: Overlong encoding of 0x28 (at offset 41)
#0      _Utf8Decoder.convert (dart:convert/utf.dart:452:13)
#1      _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:311:14)
#2      _Utf8ConversionSink.add (dart:convert/string_conversion.dart:307:5)
#3      _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:74:18)
#4      _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#5      _rootRunUnary (dart:async/zone.dart:1132:38)
#6      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#9      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#10     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#11     _StreamController._add (dart:async/stream_controller.dart:640:7)
#12     _StreamController.add (dart:async/stream_controller.dart:586:5)
#13     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1774:41)
#14     _rootRunUnary (dart:async/zone.dart:1136:13)
#15     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#16     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#17     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#18     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#19     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#20     _StreamController._add (dart:async/stream_controller.dart:640:7)
#21     _StreamController.add (dart:async/stream_controller.dart:586:5)
#22     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1323:33)
#23     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:844:14)
#24     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#26     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#27     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
KirillKaverin commented 5 years ago

I have the same error on the latest version. Looks like the problem with libusbmuxd and only with connected iOS device. If you unplug the real device and run the emulator, then flutter starts working good.

[✓] Flutter (Channel master, v1.3.14-pre.65, on Mac OS X 10.14.3 18D109, locale ru-RU)
    • Flutter version 1.3.14-pre.65 at /Users/kirill/work/flutter
    • Framework revision 1b282b0e80 (5 hours ago), 2019-03-24 05:18:43 -0400
    • Engine revision d2bba21af2
    • Dart version 2.2.1 (build 2.2.1-dev.2.0 None)

⣽Unhandled exception:
FormatException: Overlong encoding of 0x28 (at offset 41)
#0      _Utf8Decoder.convert (dart:convert/utf.dart:462:13)
#1      _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:311:14)
#2      _Utf8ConversionSink.add (dart:convert/string_conversion.dart:307:5)
#3      _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:74:18)
#4      _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#5      _rootRunUnary (dart:async/zone.dart:1132:38)
#6      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#9      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#10     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#11     _StreamController._add (dart:async/stream_controller.dart:640:7)
#12     _StreamController.add (dart:async/stream_controller.dart:586:5)
#13     _Socket._onData (dart:io/runtime/bin/socket_patch.dart:1774:41)
#14     _rootRunUnary (dart:async/zone.dart:1136:13)
#15     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#16     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#17     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#18     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#19     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#20     _StreamController._add (dart:async/stream_controller.dart:640:7)
#21     _StreamController.add (dart:async/stream_controller.dart:586:5)
#22     new _RawSocket.<anonymous closure> (dart:io/runtime/bin/socket_patch.dart:1323:33)
#23     _NativeSocket.issueReadEvent.issue (dart:io/runtime/bin/socket_patch.dart:844:14)
#24     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#26     _runPendingImmediateCallback (dart:isolate/runtime/lib/isolate_patch.dart:115:13)
#27     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:172:5)
JoeyHengst commented 5 years ago

I even have this error when no device is connected. The strange thing is that when I do a cold restart and run flutter everything is ok but when I try to do flutter run a second time I am getting this error. It’s getting really annoying that only after a full reboot of the macbook everything seems fine for only the first run |-_-|

Op zo 24 mrt. 2019 om 15:10 schreef Kirill Kaverin <notifications@github.com

I have the same error on the latest version. Looks like the problem with libusbmuxd and only with connected iOS device. If you unplug the real device and run the emulator, then flutter starts working good.

[✓] Flutter (Channel master, v1.3.14-pre.65, on Mac OS X 10.14.3 18D109, locale ru-RU)

• Flutter version 1.3.14-pre.65 at /Users/kirill/work/flutter

• Framework revision 1b282b0e80 (5 hours ago), 2019-03-24 05:18:43 -0400

• Engine revision d2bba21af2

• Dart version 2.2.1 (build 2.2.1-dev.2.0 None)

⣽Unhandled exception:

FormatException: Overlong encoding of 0x28 (at offset 41)

0 _Utf8Decoder.convert (dart:convert/utf.dart:462:13)

1 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:311:14)

2 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:307:5)

3 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:74:18)

4 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)

5 _rootRunUnary (dart:async/zone.dart:1132:38)

6 _CustomZone.runUnary (dart:async/zone.dart:1029:19)

7 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)

8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)

9 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)

10 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)

11 _StreamController._add (dart:async/stream_controller.dart:640:7)

12 _StreamController.add (dart:async/stream_controller.dart:586:5)

13 _Socket._onData (dart:io/runtime/bin/socket_patch.dart:1774:41)

14 _rootRunUnary (dart:async/zone.dart:1136:13)

15 _CustomZone.runUnary (dart:async/zone.dart:1029:19)

16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)

17 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)

18 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)

19 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)

20 _StreamController._add (dart:async/stream_controller.dart:640:7)

21 _StreamController.add (dart:async/stream_controller.dart:586:5)

22 new _RawSocket. (dart:io/runtime/bin/socket_patch.dart:1323:33)

23 _NativeSocket.issueReadEvent.issue (dart:io/runtime/bin/socket_patch.dart:844:14)

24 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)

25 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

26 _runPendingImmediateCallback (dart:isolate/runtime/lib/isolate_patch.dart:115:13)

27 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:172:5)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/29178#issuecomment-475963041, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCcPb5Yt4w3jl5OYxynMbvAkp-1epDoks5vZ4dJgaJpZM4bpip5 .

KirillKaverin commented 5 years ago

I have run 'brew doctor' and found that I have some old versions of libusbmuxd and libimobiledevice installed not using brew (I built it before from the sources). Thats why I delete the old versions (.dylib files) and reinstalled all the required libs using:

brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller

When you installing the libs using brew check the warnings very carefully, because in some cases you should overwrite the old symlinks to the new one (brew will print about it). Then try to connect the real device using the guide: https://stackoverflow.com/a/53113920

If you are still no lucky, try to change the flutter channel to another one, for example, to master ('flutter channel master && flutter upgrade').

After all the manipulations, flutter started to work fine with me (I am using 'master' channel)

[✓] Flutter (Channel master, v1.3.14-pre.65, on Mac OS X 10.14.3 18D109, locale
    ru-RU)
    • Flutter version 1.3.14-pre.65 at /Users/kirill/work/flutter
    • Framework revision 1b282b0e80 (22 hours ago), 2019-03-24 05:18:43 -0400
    • Engine revision d2bba21af2
    • Dart version 2.2.1 (build 2.2.1-dev.2.0 None)
JoeyHengst commented 5 years ago

I have run 'brew doctor' and found that I have some old versions of libusbmuxd and libimobiledevice installed not using brew (I built it before from the sources). Thats why I delete the old versions (.dylib files) and reinstalled all the required libs using:

brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller

When you installing the libs using brew check the warnings very carefully, because in some cases you should overwrite the old symlinks to the new one (brew will print about it). Then try to connect the real device using the guide: https://stackoverflow.com/a/53113920

If you are still no lucky, try to change the flutter channel to another one, for example, to master ('flutter channel master && flutter upgrade').

After all the manipulations, flutter started to work fine with me (I am using 'master' channel)

[✓] Flutter (Channel master, v1.3.14-pre.65, on Mac OS X 10.14.3 18D109, locale
    ru-RU)
    • Flutter version 1.3.14-pre.65 at /Users/kirill/work/flutter
    • Framework revision 1b282b0e80 (22 hours ago), 2019-03-24 05:18:43 -0400
    • Engine revision d2bba21af2
    • Dart version 2.2.1 (build 2.2.1-dev.2.0 None)

This worked! Thanks!

jmagman commented 4 years ago

Reasonably new versions libusbmuxd and libimobiledevice are now packaged with Flutter, so you don't need to brew them. See https://github.com/flutter/flutter/pull/36093 and https://github.com/flutter/website/pull/2971.

github-actions[bot] commented 3 years ago

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.