http
http copied to clipboard
Cronet exception: m.ms: Exception in CronetUrlRequest: net::ERR_CONNECTION_CLOSED, ErrorCode=5
Package
cronet_http
Version
1.2.1
Operating-System
Android
Output of flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-RU)
• Flutter version 3.19.6 on channel stable at /Users/dmitry/fvm/versions/3.19.6
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (6 weeks ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/dmitry/Documents/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/dmitry/Documents/sdk
• Java binary at: /Users/dmitry/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
! CocoaPods 1.12.1 out of date (1.13.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --ignore-certificate-errors
--disable-web-security --user-data-dir=/Users/dmitry/temp)
! /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --ignore-certificate-errors --disable-web-security --user-data-dir=/Users/dmitry/temp is not
executable.
[✓] Android Studio (version 2023.3)
• Android Studio at /Users/dmitry/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.10+0-17.0.10b1087.21-11572160)
[✓] IntelliJ IDEA Community Edition (version 2023.3.2)
• IntelliJ at /Users/dmitry/Applications/IntelliJ IDEA Community Edition.app
• Flutter plugin version 78.4.2
• Dart plugin version 233.15123
[✓] VS Code (version 1.87.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.88.0
[✓] Connected device (2 available)
• iPhone SE (3rd generation) (mobile) • *** • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Dart Version
3.3.4
Steps to Reproduce
- Create long polling client (that will make requests one after another for a period of time)
- Start making requests
Expected Result
Requests succeed
Actual Result
After some time requests will fail with Cronet exception: m.ms: Exception in CronetUrlRequest: net::ERR_CONNECTION_CLOSED, ErrorCode=5, InternalErrorCode=-100, Retryable=true, uri=https://***/v1/polling.getUpdates?ts=***,statusCode: null,cause: DioException [unknown]: null
Devices distribution (out of 30k events):
Full log
Cronet exception: m.ms: Exception in CronetUrlRequest: net::ERR_CONNECTION_CLOSED, ErrorCode=5, InternalErrorCode=-100, Retryable=true, uri=https://alive.go-rhino.com/v1/polling.getUpdates?ts=1717011232038) | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 27540, tid: 27615, name 1.ui
os: android arch: arm64 comp: yes sim: no
build_id: 'b866ace18fa006c0f7dae5b7963c0614'
isolate_dso_base: 797e36f000, vm_dso_base: 797e36f000
isolate_instructions: 797e5b5580, vm_instructions: 797e59f000
#00 abs 000000797ead0d0b virt 0000000000761d0b _kDartIsolateSnapshotInstructions+0x51b78b
#01 abs 000000797ead0073 virt 0000000000761073 _kDartIsolateSnapshotInstructions+0x51aaf3
#02 abs 000000797e71adcb virt 00000000003abdcb _kDartIsolateSnapshotInstructions+0x16584b
#03 abs 000000797eb2fcfb virt 00000000007c0cfb _kDartIsolateSnapshotInstructions+0x57a77b
#04 abs 000000797eb2fafb virt 00000000007c0afb _kDartIsolateSnapshotInstructions+0x57a57b
<asynchronous suspension>
How are you using package:cronet_http? I see DioException in your logs.
How are you using
package:cronet_http? I seeDioExceptionin your logs.
We have package:native_dio_adapter that can connects cronet_http and cupertino_http with the Dio instance.
I now see this exceptions too in our app and we don't use dio.
V13.3
-100 seems to mean ILLEGAL_ARGUMENT:
https://chromium.googlesource.com/chromium/src/+/master/components/cronet/native/cronet.idl#205
5 means ERROR_CONNECTION_CLOSED:
https://chromium.googlesource.com/chromium/src/+/master/components/cronet/native/cronet.idl#87
Does anyone have a traceback that indicates the line of code that this exception is originating from?
It happens on a polling GET call to our backend. Nothing special besides that we call this URL every 30s Am 25. Apr. 2025, 18:16 -0500 schrieb Brian Quinlan @.***>:
brianquinlan left a comment (dart-lang/http#1217) -100 seems to mean ILLEGAL_ARGUMENT: https://chromium.googlesource.com/chromium/src/+/master/components/cronet/native/cronet.idl#205 5 means ERROR_CONNECTION_CLOSED: https://chromium.googlesource.com/chromium/src/+/master/components/cronet/native/cronet.idl#87 Does anyone have a traceback that indicates the line of code that this exception is originating from? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
I noticed that I get this when my app goes into the background and tries to make a REST call to an API (i.e. every 30 seconds):
ClientException: Cronet exception: m.kt: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false, uri=http://my-fancy-server.com
As soon as I bring it back to the foreground everything is back to normal.
Tested on a Google Pixel 6
Could someone post a stack trace so I can see what line of code in the cronet_http package this is coming from?
Could someone post a stack trace so I can see what line of code in the
cronet_httppackage this is coming from?
The stack trace is not really helpful and most of it just mentions from what part of my app this originates
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: ClientException: Cronet exception: m.kt: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false, uri=https://my-fancy-server.com/user. Error thrown Error refreshing User resources.
#00 pc 0xe28597 com.example.app (FirebaseCrashlytics.recordError [firebase_crashlytics.dart:119]) (BuildId: cde83d06fccce350ccbd75ad4c3ac952)
#01 pc 0xe2838f com.example.app (LoggingMixin._recordError [logging_mixin.dart:107]) (BuildId: cde83d06fccce350ccbd75ad4c3ac952)
#02 pc 0xe2f1cf com.example.app (LoadResources.reloadAll [logging_mixin.dart:66]) (BuildId: cde83d06fccce350ccbd75ad4c3ac952)
#03 pc 0xe2f093 com.example.app (PreventConcurrencyMixin.preventConcurrentRuns [prevent_concurrency_mixin.dart:10]) (BuildId: cde83d06fccce350ccbd75ad4c3ac952)
#04 pc 0xe2ef67 com.example.app (LoadResources.reloadAllPeriodically [load_resources.dart:263]) (BuildId: cde83d06fccce350ccbd75ad4c3ac952)
The only line in cronet_http that mentions "Cronet exception: " is this one
https://github.com/dart-lang/http/blob/63c477b466f650e8f5505d6d78dc283c2c2f9845/pkgs/cronet_http/lib/src/cronet_client.dart#L265
facing same issue when using http call with flutter and work manager. Background sync task fails with error:
InetDiagMessage: Destroyed 2 sockets, proto=IPPROTO_TCP, family=AF_INET, states=14
07-31 21:35:25.010 658 823 D InetDiagMessage: Destroyed 0 sockets, proto=IPPROTO_TCP, family=AF_INET6, states=14
07-31 21:35:25.010 658 823 D InetDiagMessage: Destroyed live tcp sockets for uids={10225} in 0ms
07-31 21:35:25.011 658 823 D InetDiagMessage: Destroyed 0 sockets, proto=IPPROTO_TCP, family=AF_INET, states=14
07-31 21:35:25.011 658 823 D InetDiagMessage: Destroyed 0 sockets, proto=IPPROTO_TCP, family=AF_INET6, states=14
07-31 21:35:25.011 658 823 D InetDiagMessage: Destroyed live tcp sockets for uids={20225} in 1ms
07-31 21:35:25.016 8829 8829 I flutter : ❌ Sync failed after 67050ms: ClientException: Cronet exception: m1.mh: Exception in CronetUrlRequest: net::ERR_CONNECTION_ABORTED, ErrorCode=11, InternalErrorCode=-103, Retryable=false, uri=http://<url>
This could be because of https://github.com/dart-lang/http/issues/1720
Work manager creates another Flutter engine. I will fix this soon.
@HosseinYousefi Hi! Maybe you have some updates on the issue?
Maybe you have some updates on the issue?
I have a PR ready and it will be merged by the end of this week.
Maybe you have some updates on the issue?
I have a PR ready and it will be merged by the end of this week.
Could you provide a link?
Could you provide a link?
https://github.com/dart-lang/http/pull/1845
Could someone here please provide a minimal reproducible repo that has this problem? A simple get request works whether I'm using WorkManager or not.
@HosseinYousefi issue, that it's not so easy to reproduce, as it happened only after few mins/hours app was in background(and probably network switch from wifi to cellular in background may affect). We have around 900K reports in sentry per month, but I'm not able to reproduce easily it.
@HosseinYousefi issue, that it's not so easy to reproduce, as it happened only after few mins/hours app was in background(and probably network switch from wifi to cellular in background may affect). We have around 900K reports in sentry per month, but I'm not able to reproduce easily it.
I see. Maybe it has something to do with the interface we're implementing in Dart. If I create a branch and experiment with some ideas, would you be able to verify if they solve your problem?