cfug / dio

A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.
https://dio.pub
MIT License
12.25k stars 1.49k forks source link

SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104), address = XXXX, port = 49440 #2189

Closed rishuriya closed 2 weeks ago

rishuriya commented 1 month ago

Package

dio

Version

4.04

Operating-System

Android

Adapter

Default Dio

Output of flutter doctor -v

Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-x64, locale
    en-US)
    • Flutter version 3.19.5 on channel stable at
      /Users/rishav_a2z/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/rishav_a2z/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2023.2)
    • Android Studio at /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.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (2 available)
    • SM M317F (mobile) • RZ8N924CERL • android-arm64 • Android 12 (API 31)
    • macOS (desktop)   • macos       • darwin-x64    • macOS 14.4.1 23E224
      darwin-x64

[✓] Network resources
    • All expected network resources are available.

### Dart Version

3.3.3

### Steps to Reproduce

I didn’t t understand , it came recently when one of my timer constantly pinging the server, and after a while it showing the error

### Expected Result

Expected Result would be to complete the API request

### Actual Result

I/flutter (14760): SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104), address = server.margati.com, port = 49440 I/flutter (14760): Exception occurred: DioError [DioErrorType.other]: SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104), address = server.margati.com, port = 49440 I/flutter (14760): Source stack: I/flutter (14760): #0 DioMixin.fetch (package:dio/src/dio_mixin.dart:488:35) I/flutter (14760): #1 DioMixin.request (package:dio/src/dio_mixin.dart:483:12) I/flutter (14760): #2 DioMixin.post (package:dio/src/dio_mixin.dart:97:12) I/flutter (14760): #3 LoginApiProvider.getUserData (package:margati/apiProvider/loginApiProvider.dart:239:39) I/flutter (14760): I/flutter (14760): #4 UserBloc._getUser. (package:margati/bloc/userBloc/user_bloc.dart:39:45) I/flutter (14760): I/flutter (14760): #5 UserBloc._getUser (package:margati/bloc/userBloc/user_bloc.dart:39:7) I/flutter (14760): I/flutter (14760): #6 Bloc.on..handleEvent (package:bloc/src/bloc.dart:229:13) I/flutter (14760):

AlexV525 commented 1 month ago

We're not providing support for v4 of Dio. Please upgrade and provide minimal reproducible example.

kjxbyz commented 2 weeks ago

DioException [connection error]: The connection errored: Connection reset by peer This indicates an error which most likely cannot be solved by the library. Error: SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 54), address = www.googleapis.com, port = 55072