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

DioException (DioException [connection error]: The connection errored: Connection reset by peer This indicates an error which most likely cannot be solved by the library. #2204

Closed rifay-next99 closed 2 weeks ago

rifay-next99 commented 2 weeks ago

Package

dio

Version

5.4.3+1

Operating-System

Android, iOS

Adapter

Default Dio

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.19.6, on macOS 13.6.6 22G630 darwin-x64, locale en-US)
    • Flutter version 3.19.6 on channel stable at /Users/mohamedrifay/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (12 days 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/mohamedrifay/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.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

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

[✓] Connected device (3 available)            
    • iPhone 15 Plus (mobile) • F49DABF3-D98B-41B7-875C-A0A1A71277F0 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0
      (simulator)
    • macOS (desktop)         • macos                                • darwin-x64     • macOS 13.6.6 22G630 darwin-x64
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 124.0.6367.91

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

! Doctor found issues in 2 categories.

Dart Version

No response

Steps to Reproduce

I made a multiple api call parallely. Some times the error will occur.

Expected Result

Resolve this error

Actual Result

DioException (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 = ****.next99.com, port = 52094)

kuhnroyal commented 2 weeks ago

Connection reset by peer This indicates an error which most likely cannot be solved by the library.

The server likely killed your connection because you opened too many parallel requests.

rifay-next99 commented 2 weeks ago

how should achieve the withoutt kill

AlexV525 commented 2 weeks ago

For business implementation, better ask for GPTs or StackOverflow for solutions.