Skip to content
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

Failed host lookup error at every request after disconnecting and reconnecting to internet. #2179

Closed
albe-jj opened this issue Apr 9, 2024 · 5 comments

Comments

@albe-jj
Copy link

albe-jj commented Apr 9, 2024

Package

dio

Version

5.1.2

Operating-System

Windows

Adapter

Default Dio

Output of flutter doctor -v

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.21.0-5.0.pre.7, on Microsoft Windows [Version 10.0.19045.4170], locale en-GB)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.8.3)
[√] Android Studio (version 2022.2)
[√] VS Code (version 1.87.2)
[√] Connected device (3 available)
[√] Network resources

Dart Version

3.4.0-222.0.dev

Steps to Reproduce

The application every once in a while (once every two days) throws me a Failed host lookup and cannot send any further request although there is internet connection and the host can be resolved. Most of the time the connection is interrupted and I get the Failed host lookup error then the app continues working as expected after connecting back to the internet. But when I get this issue the dio instance keeps throwing the Failed host lookup error at every subsequent request although connection is available and host can be resolved. By restarting the application I can again send requests as normal.

DioException [connection error]: The connection errored: Failed host lookup: 'qdrive.qutech.tudelft.nl' This indicates an error which most likely cannot be solved by the library.
Error: SocketException: Failed host lookup: '<myhost.com>' (OS Error: No such host is known.
, errno = 11001)
#0   DioMixin.fetch.<anonymous closure> (package:dio/src/dio_mixin.dart:510)
#1   _rootRunUnary (dart:async/zone.dart:1407)
#2   _CustomZone.runUnary (dart:async/zone.dart:1308)
#3   _FutureListener.handleError (dart:async/future_impl.dart:181)
#4   Future._propagateToListeners.handleError (dart:async/future_impl.dart:859)
#5   Future._propagateToListeners (dart:async/future_impl.dart:880)
#6   Future._completeError (dart:async/future_impl.dart:660)
#7   _SyncCompleter._completeError (dart:async/future_impl.dart:63)
07:53:07.841 (+9:07:44.900048)```



### Expected Result

I would expect that even if it fails to look up the host once,  `Failed host lookup` the coming requests go through when internet connection is back. But that is not always the case. 

### Actual Result

DioException [connection error]: The connection errored: Failed host lookup: '<myhost.com>' This indicates an error which most likely cannot be solved by the library.
Error: SocketException: Failed host lookup: '<myhost.com>' (OS Error: No such host is known.
, errno = 11001)
#0 DioMixin.fetch. (package:dio/src/dio_mixin.dart:510)
#1 _rootRunUnary (dart:async/zone.dart:1407)
#2 _CustomZone.runUnary (dart:async/zone.dart:1308)
#3 _FutureListener.handleError (dart:async/future_impl.dart:181)
#4 Future._propagateToListeners.handleError (dart:async/future_impl.dart:859)
#5 Future._propagateToListeners (dart:async/future_impl.dart:880)
#6 Future._completeError (dart:async/future_impl.dart:660)
#7 _SyncCompleter._completeError (dart:async/future_impl.dart:63)
07:53:07.841 (+9:07:44.900048)

@albe-jj albe-jj added h: need triage This issue needs to be categorized s: bug Something isn't working labels Apr 9, 2024
@AlexV525
Copy link
Member

AlexV525 commented Apr 9, 2024

You can verify if the behavior occurred when using package:http or HttpClient, so we can quickly determine which part fails.

@AlexV525 AlexV525 added the h: need more info Further information is requested label Apr 9, 2024
@albe-jj
Copy link
Author

albe-jj commented Apr 14, 2024

Thanks for the reply. How can I verify this?

You can verify if the behavior occurred when using package:http or HttpClient, so we can quickly determine which part fails.

@AlexV525
Copy link
Member

By writing a minimal example to make requests using them.

@albe-jj
Copy link
Author

albe-jj commented May 19, 2024

I found out it was a problem I my code logic, when there was no connection available. Closing the issue.

@albe-jj albe-jj closed this as completed May 19, 2024
@AlexV525 AlexV525 added i: not related and removed h: need more info Further information is requested h: need triage This issue needs to be categorized s: bug Something isn't working labels May 19, 2024
@joabsantos
Copy link

@albe-jj what was the error? I'm kinda having a similar problem to this.

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

No branches or pull requests

3 participants