Skip to content

Don't let analytics block dart commands #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Levi-Lesches opened this issue Dec 6, 2023 · 8 comments
Open

Don't let analytics block dart commands #216

Levi-Lesches opened this issue Dec 6, 2023 · 8 comments

Comments

@Levi-Lesches
Copy link
Contributor

When on an unreliable internet connection, or a W/LAN network without actual Internet access (such that internet access hangs but doesn't outright fail), Dart's analytics can block any command, like dart run, dart compile, or dart analyze from running. Running dart --disable-analytics fixes the problem, but without knowing the cause ahead of time, it's difficult to know what the issue is or how to fix it.

@eliasyishak
Copy link
Contributor

@Levi-Lesches does the process hang indefinitely or does it eventually finish?

@parlough was this fixed with your recent change in Gerrit or is this unrelated?

https://dart-review.googlesource.com/c/sdk/+/339500

@Levi-Lesches
Copy link
Contributor Author

Levi-Lesches commented Feb 13, 2024

Sorry, I read this notification and then forgot to respond... but I did have to set up another device without internet the other day, and this still happens on Dart stable 3.2.6.

The process hangs indefinitely, and disabling analytics does stop it from happening again.

@eliasyishak
Copy link
Contributor

What command are you running that is causing it to hang when you aren't connected to the internet? I am try to setup a repro on my end.

Can you also provide the output from flutter doctor -v? I am currently on the stable release on my mac and I am running into this error

eliasyishak-macbookpro:~ eliasyishak$ flutter doctor -v
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.3 23D56 darwin-arm64, locale en)
    • Flutter version 3.16.9 on channel stable at /Users/eliasyishak/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (3 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/eliasyishak/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
    • IntelliJ at /Users/eliasyishak/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.86.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.3 23D56 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@eliasyishak
Copy link
Contributor

The process hangs indefinitely, and disabling analytics does stop it from happening again.

@bkonyi, did you ever see the process hang indefinitely or just for a few seconds when you made your fix in https://dart-review.googlesource.com/c/sdk/+/339500

@bkonyi
Copy link
Contributor

bkonyi commented Feb 14, 2024

The process hangs indefinitely, and disabling analytics does stop it from happening again.

@bkonyi, did you ever see the process hang indefinitely or just for a few seconds when you made your fix in https://dart-review.googlesource.com/c/sdk/+/339500

It wasn't my fix :-) However, we did have similar issues with the legacy analytics that was resolved by https://dart-review.googlesource.com/c/sdk/+/294940. Maybe we need to do something similar?

@eliasyishak
Copy link
Contributor

whoops my mistake @bkonyi, @parlough does this look familiar to you?

legacy analytics that was resolved by https://dart-review.googlesource.com/c/sdk/+/294940. Maybe we need to do something similar?

And we did implement something similar to this, except we hard coded the default timeout to be 250ms when we invoke the Analytics.close() method in this PR #184

@parlough
Copy link
Member

parlough commented Feb 14, 2024

That change did fix a few of the (non-indefinite hanging) issues I was seeing, but I'm not sure about the situation where the connection itself is unstable or hanging.

Neither that change nor the one from #184 are in the 3.2 stable branch though, so I think it'd be worth seeing if this reproduces on 3.3? @Levi-Lesches would you be able to try with a 3.3 beta build or revisit this once a stable release is made?

@Levi-Lesches
Copy link
Contributor Author

When I set up my next Raspberry Pi I will give 3.3 a quick shot to check 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants