dio icon indicating copy to clipboard operation
dio copied to clipboard

connectTimeout is not working when device is connected to a wifi which is not connected to internet

Open liufeihe opened this issue 6 years ago • 6 comments

New Issue Checklist

  • I have searched for a similar issue in the project and found none

Issue Info

Info Value
Platform Name e.g. flutter
Platform Version e.g. 1.12.13
Dio Version e.g. 3.0.8/3.0.9
Repro rate e.g. all the time (100%)

Issue Description and Steps

my app is linked to a Wifi which is not connected to internet. and i set the connnect timeout to 2 seconds. but the dio took almost 2 minutes to timeout.

i try it on dio 3.0.4/3.0.8/3.0.9, they all have the same problem

my debug info is below: I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:10:57 GMT], request get, uri=/app/user/feedbacks, data=null, params={current: 1, size: 30}, headers=null

I/flutter (25438): connectTimeout, 2000 I/flutter (25438): {content-type: application/json; charset=utf-8, Authorization: eyJhbGciOyk}

I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:12:02 GMT], uri=/app/user/feedbacks, e=DioError [DioErrorType.DEFAULT]: SocketException: Failed host lookup: 'api.lebai.ltd' (OS Error: No address associated with hostname, errno = 7)

I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:12:02 GMT], e response=null

liufeihe avatar Apr 23 '20 00:04 liufeihe

me too!The platform is ios, android is ok!

dmlzj avatar Apr 24 '20 01:04 dmlzj

me too!The platform is ios, android is ok!

my is Android. are you in the same situation? linked to a wifi which is not connected to the Internet?

liufeihe avatar Apr 24 '20 02:04 liufeihe

Adjust the DNS network to 8.8.8.8. After opening the APP and running normally, change it to default DNS and everything is ok.

you have the same situation before? why is the DNS problem? I can't let my user to change their wifi's DNS setting, it seems not a very good solution.

liufeihe avatar Apr 24 '20 02:04 liufeihe

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

stale[bot] avatar May 24 '20 03:05 stale[bot]

i meet the same question.when i disconnect from the internet,i can't see the connectTimeout.and when i connect to the internet, the task doesn't begin.

mr-52hz avatar May 28 '20 06:05 mr-52hz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

stale[bot] avatar Jun 27 '20 07:06 stale[bot]