Repository navigation
Open
Labels
package:cronet_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
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>

Reacted by Sebastian Gierth, Joachim Schmidt, Kyrylo, Anil chauhan, shashikant, Mert and Hossein Yousefi
Metadata
Metadata
Assignees
Labels
package:cronet_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Activity
brianquinlan commentedon Jul 12, 2024
How are you using
package:cronet_http? I seeDioExceptionin your logs.AlexV525 commentedon Oct 10, 2024
We have
package:native_dio_adapterthat can connectscronet_httpandcupertino_httpwith the Dio instance.escamoteur commentedon Apr 25, 2025
I now see this exceptions too in our app and we don't use dio.
V13.3
brianquinlan commentedon Apr 25, 2025
-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?
escamoteur commentedon Apr 25, 2025
techouse commentedon Apr 28, 2025
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):
As soon as I bring it back to the foreground everything is back to normal.
Tested on a Google Pixel 6
brianquinlan commentedon Apr 28, 2025
Could someone post a stack trace so I can see what line of code in the
cronet_httppackage this is coming from?techouse commentedon Apr 29, 2025
The stack trace is not really helpful and most of it just mentions from what part of my app this originates
The only line in
cronet_httpthat mentions"Cronet exception: "is this onehttp/pkgs/cronet_http/lib/src/cronet_client.dart
Line 265 in 63c477b
satya1395 commentedon Aug 1, 2025
facing same issue when using http call with flutter and work manager. Background sync task fails with error:
HosseinYousefi commentedon Aug 1, 2025
This could be because of #1720
Work manager creates another Flutter engine. I will fix this soon.
fluttersiast commentedon Nov 2, 2025
@HosseinYousefi Hi!
Maybe you have some updates on the issue?
HosseinYousefi commentedon Nov 3, 2025
I have a PR ready and it will be merged by the end of this week.
3 remaining items
fluttersiast commentedon Nov 13, 2025
@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 commentedon Nov 13, 2025
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?
fluttersiast commentedon Nov 20, 2025
I would say mostly not, as It happened only for real users and I don't know how to reproduce it locally
I can share more logs for various scenarious. Maybe that will be enough
In all scenarious user just open app from background, while in background wifi changed to cellular and vice-versa.
Also this is logs from app that do not have other isolates.
1: ERR_NETWORK_CHANGED
Error: ClientException: Cronet exception: org.chromium.net.impl.NetworkExceptionImpl: Exception in CronetUrlRequest: net::ERR_NETWORK_CHANGED, ErrorCode=3, InternalErrorCode=-21, Retryable=true, uri=LOGS:
Network Event
info
12:23:05.159 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 14,
network_type: cellular,
upload_bandwidth: 14,
vpn_active: false
}
Network Event
info
12:23:05.159 PM
{
action: NETWORK_AVAILABLE
}
Network Event
info
12:23:03.884 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 9535,
network_type: wifi,
signal_strength: -82,
upload_bandwidth: 1451,
vpn_active: false
}
Ui Lifecycle
info
12:22:56.412 PM
{
screen: MainActivity,
state: resumed
}
App Lifecycle
info
12:22:56.408 PM
{
state: foreground
}
Ui Lifecycle
info
12:22:56.406 PM
{
screen: MainActivity,
state: started
}
Network Event
info
12:22:56.352 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 40131,
network_type: wifi,
signal_strength: -55,
upload_bandwidth: 38797,
vpn_active: false
}
Network Event
info
12:22:56.350 PM
{
action: NETWORK_AVAILABLE
}
Ui Lifecycle
info
12:19:04.559 PM
{
screen: MainActivity,
state: saveInstanceState
}
Ui Lifecycle
info
12:19:04.556 PM
{
screen: MainActivity,
state: stopped
}
App Lifecycle
info
12:19:04.556 PM
{
state: background
}
Ui Lifecycle
info
12:19:03.725 PM
{
screen: MainActivity,
state: paused
}
Device Event
info
12:18:56.069 PM
{
action: BATTERY_CHANGED,
charging: false,
level: 24
}
Ui Lifecycle
info
12:18:55.996 PM
{
screen: MainActivity,
state: resumed
}
App Lifecycle
info
12:18:55.989 PM
{
state: foreground
}
Ui Lifecycle
info
12:18:55.979 PM
{
screen: MainActivity,
state: started
}
2: ERR_INTERNET_DISCONNECTED
Exception - This event error 04:29:44.000 PM Error: ClientException: Cronet exception: org.chromium.net.impl.NetworkExceptionImpl: Exception in CronetUrlRequest: net::ERR_INTERNET_DISCONNECTED, ErrorCode=2, InternalErrorCode=-106, Retryable=false, uri= Device Event info 01:29:41.094 PM{
action: BATTERY_CHANGED,
charging: false,
level: 92
}
Ui Lifecycle
info
01:29:41.063 PM
{
screen: MainActivity,
state: resumed
}
App Lifecycle
info
01:29:41.061 PM
{
state: foreground
}
Ui Lifecycle
info
01:29:41.053 PM
{
screen: MainActivity,
state: started
}
Network Event
info
01:27:34.622 PM
{
action: NETWORK_LOST
}
Device Event
warning
01:25:15.660 PM
Low memory
{
action: LOW_MEMORY,
level: 40
}
Network Event
info
01:25:15.705 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 60016,
network_type: wifi,
signal_strength: -65,
upload_bandwidth: 12390,
vpn_active: false
}
App Lifecycle
info
12:47:46.590 PM
{
state: background
}
Device Event
info
12:47:46.429 PM
{
action: SCREEN_OFF,
extras: {
reason: 4,
why: 2
}
}
Device Event
info
12:47:46.323 PM
{
action: DREAMING_STARTED
}
Ui Lifecycle
info
12:47:45.935 PM
{
screen: MainActivity,
state: saveInstanceState
}
Ui Lifecycle
info
12:47:45.933 PM
{
screen: MainActivity,
state: stopped
}
Ui Lifecycle
info
12:47:45.889 PM
{
screen: MainActivity,
state: paused
}
Network Event
info
12:47:38.360 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 60016,
network_type: wifi,
signal_strength: -51,
upload_bandwidth: 12390,
vpn_active: false
}
Device Event
info
12:47:30.867 PM
{
action: BATTERY_CHANGED,
charging: false,
level: 94
}
Network Event
info
12:47:30.870 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 60016,
network_type: wifi,
signal_strength: -60,
upload_bandwidth: 12390,
vpn_active: false
}
Network Event
info
12:47:30.870 PM
{
action: NETWORK_AVAILABLE
}
App Lifecycle
info
12:47:27.607 PM
{
state: foreground
}
3: ERR_CONNECTION_ABORTED
Exception - This event error 04:31:53.000 PM DioException: DioException [unknown]: null Error: ClientException: Cronet exception: org.chromium.net.impl.NetworkExceptionImpl: Exception in CronetUrlRequest: net::ERR_CONNECTION_ABORTED, ErrorCode=11, InternalErrorCode=-103, Retryable=false, uri= Device Event info 01:31:52.923 PM{
action: BATTERY_CHANGED,
charging: false,
level: 29
}
Network Event
info
01:31:53.842 PM
{
action: NETWORK_LOST
}
Network Event
info
01:31:52.931 PM
{
action: NETWORK_CAPABILITIES_CHANGED,
download_bandwidth: 24579,
network_type: wifi,
signal_strength: -84,
upload_bandwidth: 2710,
vpn_active: false
}
Network Event
info
01:31:52.931 PM
{
action: NETWORK_AVAILABLE
}
App Lifecycle
info
01:31:44.491 PM
{
state: foreground
}
brianquinlan commentedon Nov 20, 2025
I think that this occurs when the network changes or is disconnected. You can see these errors for cronet (and Chrome) outside of the Dart package, e.g. https://issues.chromium.org/issues/40144418
fluttersiast commentedon Nov 21, 2025
I see that it's marked as FIXED....As far as I understand we have 2 ways to eliminate this error.
I will try to go with second option and let's see how it will work. In a month or two will share results as need to prepare release etc.
HosseinYousefi commentedon Dec 9, 2025
Can you check if this has gotten fixed by #1862 or not?
fluttersiast commentedon Dec 11, 2025
OK, will check this as well.
What I found, that cronet should also have access to
android.permission.ACCESS_WIFI_STATEto be able to detect when connection changes from WIFI to Cellular and vice versa (there is nothing in documentation).johnswarbrick commentedon Jan 8, 2026
I'm experiencing the same
net::ERR_NAME_NOT_RESOLVEDerrors on Android when usingcronet_httpversion1.7.0with QUIC enabled:Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=falseLike @satya1395 these errors appear when HTTP POST requests are scheduled with Android WorkManager using Cronet..
But they only fail when the device is connected with mobile data, they never fail when connected with WiFi.
I cannot test whether #1862 fixes the issue as this change has not yet been tagged in a release.
Environment
cronet_http: 1.7.0Logs
johnswarbrick commentedon Feb 23, 2026
I reported this previously on
cronet_http1.7.0 and can confirm the issue persists on 1.8.0 - the async callback fix in #1862 does not resolve this.The error is
ERROR_HOSTNAME_NOT_RESOLVED(ErrorCode=1, InternalErrorCode=-105), notERROR_CONNECTION_CLOSED(ErrorCode=5), so this may be a separate root cause from the original report, though the trigger conditions are identical (Cronet + WorkManager background isolate).Conditions
enableQuic: false) resolves the issue — DNS resolution succeeds on mobile data with HTTP/2 onlyConnectivityServiceconfirms a network is assigned to the WorkManager process (NetReassign [8668 : null → 131])Hypothesis
When QUIC is enabled, Cronet appears to use a different DNS resolution path that fails on cellular networks in background isolates. With QUIC disabled, the same request succeeds on the same network — so the underlying network connectivity and standard DNS resolution are both functional. This points to QUIC-specific DNS behavior (possibly HTTPS RR / SVCB record lookups, or Cronet's built-in DNS resolver being activated only when QUIC is enabled) that fails when the cellular network's DNS configuration is not properly inherited by the background isolate.
Potential investigation areas
QUIC-specific DNS resolution path. The Android
DnsOptionsdocs explicitly state it is "only relevant ifenableQuicis enabled" — confirming that QUIC activates a different DNS code path. This likely involves Cronet's built-in resolver (for HTTPS RR / SVCB record lookups needed by QUIC) rather than the system resolver. The built-in resolver may not inherit the cellular network's DNS server configuration in a WorkManager isolate, while the system resolver (used when QUIC is disabled) does.Exposing
DnsOptionsin the Dart API. The AndroidDnsOptionsAPI exposesuseBuiltInDnsResolver,enableStaleDns, andpersistHostCache— none of which are currently surfaced in the DartCronetEngine.build()API. ExposinguseBuiltInDnsResolver: falsewould allow falling back to the system resolver even with QUIC enabled, which based on our testing would resolve the issue.Stale DNS / persistent host cache.
DnsOptionssupportspersistHostCacheandenableStaleDns. If the Dart API exposed these with a sharedstoragePath, WorkManager isolates could resolve from a DNS cache populated by the foreground engine — avoiding the need for a live DNS query from the built-in resolver entirely.Network binding in background isolates. Even if the built-in resolver is required for QUIC, it may simply need to be bound to the active cellular network. Android's [
ConnectivityManager.bindProcessToNetwork()(https://developer.android.com/reference/android/net/ConnectivityManager#bindProcessToNetwork(android.net.Network)) called before building theCronetEnginecould ensure the resolver uses the correct network. This could be handled internally by the plugin when it detects it's running outside the main isolate.Environment
cronet_http: 1.8.0 (previously reproduced on 1.7.0)package:workmanager^0.9.0[cronet_http] Add DNS configuration options to CronetEngine.build
[cronet_http] Add DNS configuration options to CronetEngine.build
fryette commentedon Jul 2, 2026
I have around 60k users affected per week.
I raised draft PR, and will back in a 7-10d to confirm that dns resolve the isue
brianquinlan commentedon Jul 20, 2026
Did your PR resolve the issue? Do you know how running in a WorkManager isolate (what is that BTW) affects the behavior of Cronet?
fryette commentedon Jul 21, 2026
I don't have isolates but still struggle with DNS resolvers, now I see significantly less DNS issues.
My MR just expose more API for cronet, so developers may configure it in a more accurate way.
Actually I think main issue was with maxStaleDnsExpiredDelay
[cronet_http] Add DNS configuration options to CronetEngine.build (#1945