Repository navigation
Closed
flutter/packages
#20Labels
c: crashStack traces logged to the consoleStack traces logged to the consoletoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
flutter attach crashes basically as soon as I start it. I'm suspecting it might be encountering some strange mDNS record which makes it crash, since I'm currently on a large corporate network. Will try again tonight at home to see if it's reproducible there.
Steps to Reproduce
flutter attach
Logs
[ +41 ms] executing: [/Users/linus/coding/flutter/] git log -n 1 --pretty=format:%H
[ +44 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] 0ba67226ee62d6c9d663a6f8410fb4b2f1076046
[ ] executing: [/Users/linus/coding/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +98 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.5.8-0-g0ba67226e
[ +16 ms] executing: [/Users/linus/coding/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +15 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/dev
[ ] executing: [/Users/linus/coding/flutter/] git ls-remote --get-url origin
[ +15 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +78 ms] executing: [/Users/linus/coding/flutter/] git rev-parse --abbrev-ref HEAD
[ +13 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] dev
[ +457 ms] executing: /usr/local/share/android-sdk/platform-tools/adb devices -l
[ +13 ms] Exit code 0 from: /usr/local/share/android-sdk/platform-tools/adb devices -l
[ ] List of devices attached
[ +7 ms] executing: idevice_id -h
[ +175 ms] executing: which ideviceinstaller
[ +8 ms] Exit code 0 from: which ideviceinstaller
[ ] /usr/local/bin/ideviceinstaller
[ ] executing: which iproxy
[ +5 ms] Exit code 0 from: which iproxy
[ ] /usr/local/bin/iproxy
[ +6 ms] /usr/bin/xcrun simctl list --json devices
[ +353 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FuchsiaCacheArtifacts' is not required, skipping update.
[ +144 ms] Checking for advertised Dart observatories...
Unhandled exception:
FormatException: Bad UTF-8 encoding 0xc (at offset 22)
#0 _Utf8Decoder.convert (dart:convert/utf.dart:444:15)
#1 Utf8Decoder.convert (dart:convert/utf.dart:327:13)
#2 Utf8Codec.decode (dart:convert/utf.dart:59:56)
#3 _readFQDN (package:multicast_dns/src/packet.dart:165:24)
#4 decodeMDnsResponse.readResourceRecord (package:multicast_dns/src/packet.dart:240:36)
#5 decodeMDnsResponse (package:multicast_dns/src/packet.dart:350:55)
#6 MDnsClient._handleIncoming (package:multicast_dns/multicast_dns.dart:194:45)
#7 _rootRunUnary (dart:async/zone.dart:1136:13)
#8 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#12 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#13 _StreamController._add (dart:async/stream_controller.dart:640:7)
#14 _StreamController.add (dart:async/stream_controller.dart:586:5)
#15 new _RawDatagramSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1859:33)
#16 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:844:14)
#17 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#18 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#19 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
Flutter doctor output:
[✓] Flutter (Channel dev, v1.5.8, on Mac OS X 10.14.4 18E226, locale en-GB)
• Flutter version 1.5.8 at /Users/linus/coding/flutter
• Framework revision 0ba67226ee (6 days ago), 2019-04-24 17:18:28 -0700
• Engine revision c63d1cf9c9
• Dart version 2.3.0 (build 2.3.0-dev.0.1 1f1592edce)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /usr/local/share/android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /usr/local/share/android-sdk
• ANDROID_SDK_ROOT = /usr/local/share/android-sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• ios-deploy 1.9.4
• CocoaPods version 1.6.1
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.33.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.25.1
[✓] Connected device (1 available)
• Linus Unnebäck’s iPhone • f94aa6361e142ab9641a700b2eb487e8611738f4 • ios • iOS 12.2
• No issues found!
Metadata
Metadata
Assignees
Labels
c: crashStack traces logged to the consoleStack traces logged to the consoletoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Activity
LinusU commentedon May 1, 2019
Interestingly enough, it seems to be at different offset every time I run the command 🤔
Out of 500 tries:
blasten commentedon May 1, 2019
@LinusU Thanks for the logs. I was wondering if you could add some print statements to dump the packet that is causing the issue.
This is the patch I have been working on flutter/packages@master...blasten:catch-format-exception.
Steps:
cd ~/.pub-cache/hosted/pub.dartlang.org/multicast_dns-*/lib/src/mv packet.dart _packet.dartcurl https://raw.githubusercontent.com/blasten/packages/815c8251c5136665ea4f5c237d5cb82885ecd7d1/packages/multicast_dns/lib/src/packet.dart --output packet.dartwhich flutter | sed "s/flutter$/cache\/flutter_tools\.snapshot/" | xargs rmRun
flutter attachagain.Send us the packet: "The source bytes were: ..."
mv ~/.pub-cache/hosted/pub.dartlang.org/multicast_dns-*/lib/src/_packet.dart ~/.pub-cache/hosted/pub.dartlang.org/multicast_dns-*/lib/src/packet.dartLet me know if this doesn't work.
LinusU commentedon May 2, 2019
Those are really detailed instructions, thanks! I was looking at that PR, but wasn't sure on how to test it out locally...
Applying the changes gives me an entirely different error though 🤔 I think I saw this when disconnecting from the wifi with the previous build...
I did do another test just before applying the patch, and that gave me the same error as always. Will try to de-apply the patch and see if it comes back...
edit: yes, de-applying the patch brings back the original UTF8 error
command
flutter attach
exception
NoSuchMethodError: NoSuchMethodError: The getter 'port' was called on null.
Receiver: null
Tried calling: port
flutter doctor
LinusU commentedon May 2, 2019
Okay, I managed to just edit the file in place and found a lot of offending parts. Looking at the data it seems like there is some problem with the offset/lengths into the backing data. Basically, the data in each part printed would look something like this:
ck...s MacBook Pro. . (several non-ascii bytes) LinuBut with other names, presumably of other people working in the same co-working space as me. Because of that I didn't want to share the raw packets publicly here, but I'd be happy to share them privately with you, just let me know where to send them.
The Uint8Lists passed to utf8.decode seems to 1) start not where the string should start (i.e. if the name of my computer is "Linus Unnebäck's MacBook Pro" it will start several bytes into that string, and 2) have too many bytes so that it includes other binary data after the string, and also part of the next entry after that (i.e. it will have the end of one name, then some binary data, and then the start of another name, or even an entire other entry, and then the start of a third).
Some observations:
C00CC00C 000C0001 00000E@blasten it seems like there is an off-by-one error when reading the first name length, making everything else after that read from basically random places in the data
dnfield commentedon May 2, 2019
The first error was another bug we fixed yesterday.
The second is interesting. It would be very helpful if you could somehow get a sanitized reproduction of the packet (s) causing this
dnfield commentedon May 2, 2019
I'm willing to bet there's somewhere we assume we can advance by one byte but there's a multibyte character were going into the middle of
blasten commentedon May 2, 2019
@LinusU Thanks for looking into it! The entire packet will be very useful. Feel free to send it to me in a DM via our Slack channel: https://fluttercommunity.slack.com - Search for Emmanuel.
blasten commentedon May 3, 2019
I think I found the fix to the bug @dnfield : blasten/packages@5785eb5
@LinusU would you mind trying this out?
LinusU commentedon May 3, 2019
Tried it out, it reads the length one byte too early instead of too late now 😆
Sending you packets on Slack 👌
blasten commentedon May 3, 2019
I noted I missed this commit: blasten/packages@bb88fd3. The last packet you sent me seems to be passing with this last change.
LinusU commentedon May 3, 2019
With that one, everything seems to work 🙌
Now I'm getting to the
NoSuchMethodError: The getter 'port' was called on null.problem instead, but I think that's fixed on master 👌dnfield commentedon May 3, 2019
Let's leave this open until the fix lands in the framework.
blasten commentedon May 6, 2019
This issue is fixed in master now 🎉
Bluelich commentedon Jun 6, 2019
@blasten when will you merge this change to the stable branch? The version of stable channel is
v1.5.4-hotfix.2nowdnfield commentedon Jun 6, 2019
@Bluelich this fix is available on the current beta. If it's important to your workflow, you should probably just start using the beta. It will eventually roll into stable, and it's very rare that any changes are made from when it's in beta to when it's in stable.
See https://github.com/flutter/flutter/wiki/Flutter-build-release-channels#which-channel-should-i-use for more details on how to pick which channel to use, and a bit more details about the cadence at which stable releases are normally made.
blasten commentedon Jun 6, 2019
+1 to what @dnfield said. Also, from: https://groups.google.com/forum/#!topic/flutter-announce/oIzwT9EDczc:
github-actions commentedon Aug 29, 2021
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 -vand a minimal reproduction of the issue.