Skip to content

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

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
JSBmanD opened this issue May 30, 2024 · 8 comments
Assignees
Labels
package:cronet_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@JSBmanD
Copy link

JSBmanD commented May 30, 2024

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
@brianquinlan
Copy link
Collaborator

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

@AlexV525
Copy link
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.

@escamoteur
Copy link

escamoteur commented Apr 25, 2025

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

V13.3

@brianquinlan
Copy link
Collaborator

-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
Copy link

escamoteur commented Apr 25, 2025 via email

@techouse
Copy link

techouse commented 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):

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

@brianquinlan
Copy link
Collaborator

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

@techouse
Copy link

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:cronet_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants