Skip to content

Cronet exception: m.ms: Exception in CronetUrlRequest: net::ERR_CONNECTION_CLOSED, ErrorCode=5 #1217

Open

Description

@JSBmanD

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

  1. Create long polling client (that will make requests one after another for a period of time)
  2. 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):
image

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>
image

Activity

  1. brianquinlan commented on Jul 12, 2024

    @brianquinlan
    Collaborator

    How are you using package:cronet_http? I see DioException in your logs.

  2. AlexV525 commented on Oct 10, 2024

    @AlexV525
    Contributor

    How are you using package:cronet_http? I see DioException in your logs.

    We have package:native_dio_adapter that can connects cronet_http and cupertino_http with the Dio instance.

  3. escamoteur commented on Apr 25, 2025

    @escamoteur

    I now see this exceptions too in our app and we don't use dio.

    V13.3

  4. brianquinlan commented on Apr 25, 2025

    @brianquinlan
    Collaborator
  5. escamoteur commented on Apr 25, 2025

    @escamoteur
  6. techouse commented on Apr 28, 2025

    @techouse

    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

  7. brianquinlan commented on Apr 28, 2025

    @brianquinlan
    Collaborator

    Could someone post a stack trace so I can see what line of code in the cronet_http package this is coming from?

  8. techouse commented on Apr 29, 2025

    @techouse

    Could someone post a stack trace so I can see what line of code in the cronet_http package 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

    'Cronet exception: ${cronetException.toString()}', request.url);

  9. satya1395 commented on Aug 1, 2025

    @satya1395

    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>
    
  10. HosseinYousefi commented on Aug 1, 2025

    @HosseinYousefi
    Contributor

    This could be because of #1720

    Work manager creates another Flutter engine. I will fix this soon.

  11. fluttersiast commented on Nov 2, 2025

    @fluttersiast

    @HosseinYousefi Hi!
    Maybe you have some updates on the issue?

  12. HosseinYousefi commented on Nov 3, 2025

    @HosseinYousefi
    Contributor

    Maybe you have some updates on the issue?

    I have a PR ready and it will be merged by the end of this week.

  13. 3 remaining items

  14. fluttersiast commented on Nov 13, 2025

    @fluttersiast

    @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.

  15. HosseinYousefi commented on Nov 13, 2025

    @HosseinYousefi
    Contributor

    @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?

  16. fluttersiast commented on Nov 20, 2025

    @fluttersiast

    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
    }

  17. brianquinlan commented on Nov 20, 2025

    @brianquinlan
    Collaborator

    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

  18. fluttersiast commented on Nov 21, 2025

    @fluttersiast

    I see that it's marked as FIXED....As far as I understand we have 2 ways to eliminate this error.

    1. Wait a fix(but noone know how to fix it since it's still reproducible )
    2. Write a wrapper around Client interface and in case of hitting this issue - recreate a try to recreate a client.

    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.

  19. HosseinYousefi commented on Dec 9, 2025

    @HosseinYousefi
    Contributor

    Can you check if this has gotten fixed by #1862 or not?

  20. fluttersiast commented on Dec 11, 2025

    @fluttersiast

    OK, will check this as well.

    What I found, that cronet should also have access to android.permission.ACCESS_WIFI_STATE to be able to detect when connection changes from WIFI to Cellular and vice versa (there is nothing in documentation).

  21. johnswarbrick commented on Jan 8, 2026

    @johnswarbrick

    I'm experiencing the same net::ERR_NAME_NOT_RESOLVED errors on Android when using cronet_http version 1.7.0 with QUIC enabled:

    Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false

    Like @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.0
    • Flutter: 3.29.x
    • Android 10+ (multiple devices)
    • Backend: Cloudflare (HTTP/3 enabled)
    • HTTP POST requests executed from Android WorkManager

    Logs

    01-08 16:20:13.420  1616 13797 D ConnectivityService: requestNetwork for uid/pid:10399/13492 activeRequest: null callbackRequest: 8667 [NetworkRequest [ REQUEST id=8668, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10399 RequestorUid: 10399 RequestorPkg: com.myapp.myapp UnderlyingNetworks: Null] ]] callback flags: 0 order: 2147483647 isUidTracked: false declaredMethods: AVAIL|LOST|NC
    01-08 16:20:13.439  1616  2107 D ConnectivityService: NetReassign [8668 : null → 131] [c 0] [a 5] [i 12]
    01-08 16:20:13.454 13492 13520 D WM-Processor: Processor: processing WorkGenerationalId(workSpecId=fc71ebf8-cdab-4aa7-a4f2-cecfcdcf5d4f, generation=0)
    01-08 16:20:13.471 13492 13492 D WM-WorkerWrapper: Starting work for dev.fluttercommunity.workmanager.BackgroundWorker
    01-08 16:20:13.549 13492 19651 I flutter : [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(62)] Using the Impeller rendering backend (Vulkan).
    01-08 16:20:16.025 13492 13492 I flutter : [WorkManager] Task started: com.myapp.periodicSync
    01-08 16:20:16.043 13492 13492 I flutter : [WorkManager] Starting periodic sync...
    01-08 16:20:16.428 13492 13492 I flutter : ╔══════════════════════════════════════════════════════════════
    01-08 16:20:16.429 13492 13492 I flutter : ║ 🌐 HTTP Client Configuration
    01-08 16:20:16.429 13492 13492 I flutter : ╠══════════════════════════════════════════════════════════════
    01-08 16:20:16.430 13492 13492 I flutter : ║ Platform:  android
    01-08 16:20:16.430 13492 13492 I flutter : ║ Client:    Cronet
    01-08 16:20:16.430 13492 13492 I flutter : ║ Config:    HTTP/2: ✓, QUIC/HTTP3: ✓ ENABLED, Brotli: ✓
    01-08 16:20:16.431 13492 13492 I flutter : ║ Timeout:   8s
    01-08 16:20:16.431 13492 13492 I flutter : ╚══════════════════════════════════════════════════════════════
    01-08 16:20:16.898 13492 13492 I flutter : [WorkManager] API attempt 1/3
    01-08 16:20:17.485 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 1): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:17.485 13492 13492 I flutter : [WorkManager] Waiting 1s before internal retry...
    01-08 16:20:18.517 13492 13492 I flutter : [WorkManager] API attempt 2/3
    01-08 16:20:18.570 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 2): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:18.570 13492 13492 I flutter : [WorkManager] Waiting 1s before internal retry...
    01-08 16:20:20.078 13492 13492 I flutter : [WorkManager] API attempt 3/3
    01-08 16:20:20.131 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 3): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:20.131 13492 13492 I flutter : [WorkManager] All 3 internal attempts failed
    01-08 16:20:20.136 13492 13492 I flutter : [WorkManager] Last error: ClientException: Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false, uri=https://api.example.com/sync
    01-08 16:20:20.136 13492 13492 I flutter : [WorkManager] Returning to WorkManager for exponential backoff retry
    
  22. johnswarbrick commented on Feb 23, 2026

    @johnswarbrick

    I reported this previously on cronet_http 1.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), not ERROR_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

    • HTTP POST requests executed from Android WorkManager (separate Flutter engine/isolate)
    • Cronet with QUIC enabled and QUIC hints for the target host
    • Fails only on mobile data (4G/5G) — never on WiFi
    • Disabling QUIC (enableQuic: false) resolves the issue — DNS resolution succeeds on mobile data with HTTP/2 only
    • The device has network connectivity — Android's ConnectivityService confirms a network is assigned to the WorkManager process (NetReassign [8668 : null → 131])
    • Retries within the same WorkManager task all fail with the same DNS error
    • Subsequent WorkManager retries (via exponential backoff) eventually succeed once the system reschedules the task

    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

    1. QUIC-specific DNS resolution path. The Android
      DnsOptions docs explicitly state it is "only relevant if enableQuic is 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.

    2. Exposing DnsOptions in the Dart API. The Android DnsOptions API exposes useBuiltInDnsResolver, enableStaleDns, and persistHostCache — none of which are currently surfaced in the Dart CronetEngine.build() API. Exposing useBuiltInDnsResolver: false would allow falling back to the system resolver even with QUIC enabled, which based on our testing would resolve the issue.

    3. Stale DNS / persistent host cache. DnsOptions supports persistHostCache and enableStaleDns. If the Dart API exposed these with a shared storagePath, 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.

    4. 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 the CronetEngine could 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)
    • Flutter: 3.29.x
    • Android 10+ (multiple devices)
    • Backend: Cloudflare (HTTP/3 enabled)
    • WorkManager via package:workmanager ^0.9.0
    01-08 16:20:13.420  1616 13797 D ConnectivityService: requestNetwork for uid/pid:10399/13492 activeRequest: null callbackRequest: 8667 [NetworkRequest [ REQUEST id=8668, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10399 RequestorUid: 10399 RequestorPkg: com.myapp.myapp UnderlyingNetworks: Null] ]] callback flags: 0 order: 2147483647 isUidTracked: false declaredMethods: AVAIL|LOST|NC
    01-08 16:20:13.439  1616  2107 D ConnectivityService: NetReassign [8668 : null → 131] [c 0] [a 5] [i 12]
    01-08 16:20:13.454 13492 13520 D WM-Processor: Processor: processing WorkGenerationalId(workSpecId=fc71ebf8-cdab-4aa7-a4f2-cecfcdcf5d4f, generation=0)
    01-08 16:20:13.471 13492 13492 D WM-WorkerWrapper: Starting work for dev.fluttercommunity.workmanager.BackgroundWorker
    01-08 16:20:13.549 13492 19651 I flutter : [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(62)] Using the Impeller rendering backend (Vulkan).
    01-08 16:20:16.025 13492 13492 I flutter : [WorkManager] Task started: com.myapp.periodicSync
    01-08 16:20:16.043 13492 13492 I flutter : [WorkManager] Starting periodic sync...
    01-08 16:20:16.428 13492 13492 I flutter : ╔══════════════════════════════════════════════════════════════
    01-08 16:20:16.429 13492 13492 I flutter : ║ 🌐 HTTP Client Configuration
    01-08 16:20:16.429 13492 13492 I flutter : ╠══════════════════════════════════════════════════════════════
    01-08 16:20:16.430 13492 13492 I flutter : ║ Platform:  android
    01-08 16:20:16.430 13492 13492 I flutter : ║ Client:    Cronet
    01-08 16:20:16.430 13492 13492 I flutter : ║ Config:    HTTP/2: ✓, QUIC/HTTP3: ✓ ENABLED, Brotli: ✓
    01-08 16:20:16.431 13492 13492 I flutter : ║ Timeout:   8s
    01-08 16:20:16.431 13492 13492 I flutter : ╚══════════════════════════════════════════════════════════════
    01-08 16:20:16.898 13492 13492 I flutter : [WorkManager] API attempt 1/3
    01-08 16:20:17.485 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 1): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:17.485 13492 13492 I flutter : [WorkManager] Waiting 1s before internal retry...
    01-08 16:20:18.517 13492 13492 I flutter : [WorkManager] API attempt 2/3
    01-08 16:20:18.570 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 2): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:18.570 13492 13492 I flutter : [WorkManager] Waiting 1s before internal retry...
    01-08 16:20:20.078 13492 13492 I flutter : [WorkManager] API attempt 3/3
    01-08 16:20:20.131 13492 13492 I flutter : [WorkManager] HTTP client error (attempt 3): Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false
    01-08 16:20:20.131 13492 13492 I flutter : [WorkManager] All 3 internal attempts failed
    01-08 16:20:20.136 13492 13492 I flutter : [WorkManager] Last error: ClientException: Cronet exception: m1.mo: Exception in CronetUrlRequest: net::ERR_NAME_NOT_RESOLVED, ErrorCode=1, InternalErrorCode=-105, Retryable=false, uri=https://api.example.com/sync
    01-08 16:20:20.136 13492 13492 I flutter : [WorkManager] Returning to WorkManager for exponential backoff retry
    
  23. fryette commented on Jul 2, 2026

    @fryette
    Contributor

    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

  24. brianquinlan commented on Jul 20, 2026

    @brianquinlan
    Collaborator

    Did your PR resolve the issue? Do you know how running in a WorkManager isolate (what is that BTW) affects the behavior of Cronet?

  25. fryette commented on Jul 21, 2026

    @fryette
    Contributor

    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

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

Metadata

Metadata

Assignees

Labels

package:cronet_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions