I don't know if this is the correct location for this issue. If not, please tell me (where to open it otherwise).
When using AdGuard on macOS Big Sur and enabling Automatically filter applications in mode Network Extension, the commands flutter pub get and flutter pub upgrade don't work. Both show the same error:
Unhandled exception:
Bad state: Future already completed
#0 _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
dart-lang/sdk#1 _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io-patch/socket_patch.dart:678:23)
dart-lang/sdk#2 _NativeSocket.issueWriteEvent.issue (dart:io-patch/socket_patch.dart:1043:14)
dart-lang/sdk#3 _NativeSocket.issueWriteEvent (dart:io-patch/socket_patch.dart:1050:12)
dart-lang/sdk#4 _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1071:11)
dart-lang/sdk#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
Moved to the pub repository.
Not sure what the desired behavior is, but crashing with a bad state isn't it.
I wonder who is throwing that stack trace?...
Is it the flutter tool wrapping pub, or the pub tool itself.
It doesn't look like it's from the pub tool - you would usually get a bit more "friendly" message wrapping the stack-trace.
I tried installing AdGuard (on mac) but the problem did not seem to reproduce for me.
Could you try running dart pub upgrade in the same project directory with this problem?
Seems to be the same as: https://github.com/flutter/flutter/issues/40515
It does appear to be a bug in dart:io. The person who last touched that code has left the company, so I guess someone else needs to dig in and understand what's going on. 馃槰
I wonder who is throwing that stack trace?...
Is it the flutter tool wrapping pub, or the pub tool itself.
It doesn't look like it's from the pub tool - you would usually get a bit more "friendly" message wrapping the stack-trace.I tried installing AdGuard (on mac) but the problem did not seem to reproduce for me.
Could you try running
dart pub upgradein the same project directory with this problem?
The output of dart pub upgrade:
Resolving dependencies... Unhandled exception:
Bad state: Future already completed
#0 _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
#1 _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io-patch/socket_patch.dart:678:23)
#2 _NativeSocket.issueWriteEvent.issue (dart:io-patch/socket_patch.dart:1043:14)
#3 _NativeSocket.issueWriteEvent (dart:io-patch/socket_patch.dart:1050:12)
#4 _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1071:11)
#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12).
To reproduce, try:
In AdGuard Preferences, go to:
Network
Automatically filter applications
Automatic Proxy -> Select mode... -> Network Extension
Maybe interesting:
In a Flutter repository where all dependencies are up to date (flutter pub get has just completed successfully), there is no error with pub get and the above settings.
flutter pub get only crashes if there is something new in pubspec.yaml
flutter pub upgrade crashes every time
Hmm - Network Extension is not available to me. I guess because I'm on macOS 10.15.7 (catalina).
FYI, I got this issue when using Avast as a firewall. Disabling the Avast firewall and using the Mac's default firewall seemed to workaround this issue.
I have the same issue with Sophos / macOS 11.2.1
Most helpful comment
The output of
dart pub upgrade:To reproduce, try:
In
AdGuard Preferences, go to:NetworkAutomatically filter applicationsAutomatic Proxy->Select mode...->Network ExtensionMaybe interesting:
In a Flutter repository where all dependencies are up to date (flutter pub get has just completed successfully), there is no error with pub get and the above settings.
flutter pub getonly crashes if there is something new in pubspec.yamlflutter pub upgradecrashes every time