dio icon indicating copy to clipboard operation
dio copied to clipboard

connectTimeout/receiveTimeout doesn't work

Open JCKodel opened this issue 6 years ago • 35 comments

New Issue Checklist

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

Issue Info

Info Value
Platform Name flutter / android
Platform Version 1.12.13+hotfix.8 / 7.0
Dio Version 3.0.9
Repro rate all the time (100%)

Issue Description and Steps

Dio options:

 __dio = Dio(BaseOptions(
      headers: {"Accept": "application/json"},
      responseType: ResponseType.json,
      receiveTimeout: 30000,
      connectTimeout: 5000,
      followRedirects: false,
      receiveDataWhenStatusError: true,
      baseUrl: _baseUrl,
    ));

When my server takes more then 5s to process something, it fails with timeout. BUT the CONNECT timeout is 5s, not the RECEIVE timeout.

I expect that connect has resolved since it has successfully connected to the client (it didn't receive any response yet, hence the bigger receiveTimeout setting).

JCKodel avatar Mar 30 '20 19:03 JCKodel

It seems a duplicate from #494 ?

Does it used to work in 2.x version?

MoacirSchmidt avatar Apr 13 '20 00:04 MoacirSchmidt

i have the same issue in flutter 1.12.14. my device is android.

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`

It seems a duplicate from #494 ?

Does it used to work in 2.x version?

liufeihe avatar Apr 22 '20 06:04 liufeihe

i have some problem, version v3.0.9. pls help to fix this

yunnywu avatar Apr 22 '20 11:04 yunnywu

This is NOT about not working timeout! This is about connection timeout being different than receive timeout!!!

JCKodel avatar Apr 22 '20 19:04 JCKodel

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 22 '20 19:05 stale[bot]

Please do not close. Problem still persists in latest version.

MoacirSchmidt avatar May 22 '20 19:05 MoacirSchmidt

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 21 '20 20:06 stale[bot]

same problem in v3.0.9

Yuliang-Lee avatar Jul 09 '20 07:07 Yuliang-Lee

Please reopen this issue

gabcarneiro avatar Jul 17 '20 14:07 gabcarneiro

3.0.9 still has this problem,Please reopen this issue

sjimy avatar Jul 20 '20 01:07 sjimy

This problem still exists in 3.0.9. Please reopen this problem. This problem will appear every time and is easy to find. Why not solve it as soon as possible?

3.0.9还存在此问题,请重新开启这个问题,这个问题必现,很容易发现,为什么不尽快解决呢?

sjimy avatar Jul 21 '20 15:07 sjimy

3.0.9 still has this problem,Please reopen this issue

heimabailang avatar Aug 31 '20 08:08 heimabailang

Please reopen this issues. am really facing problems with this

colabra1000 avatar Nov 04 '20 10:11 colabra1000

Same issue on 3.0.10

patuoynageek avatar Feb 26 '21 01:02 patuoynageek

Please consider reopening this issue, or at least clarifying how connectTimeout works and/or pinning this issue. In my app, for operations involving potentially large images this issue caused intermittent crashes for some users (depending on their internet speed).

Not a great issue to debug because — like others — I assumed the connectTimeout was only relevant for actually connecting to the server. My server handled requests successfully so I did not figure out the actual issue until I logged errors in the app to the cloud.

Jjagg avatar Mar 13 '21 14:03 Jjagg

version 3.0.10 Please resolve this bug.

amberfan avatar May 07 '21 09:05 amberfan

This is still an issue! I'm having an issue with downloading. Connection timeout never throws an error and then receive timeout throws an error even in the middle of a successful download.

Has anyone found a workaround? I tried #844 but no luck.

mikezander avatar May 13 '21 02:05 mikezander

Having the same problem anyone had success resolving it ?

Jojoooo1 avatar May 13 '21 15:05 Jojoooo1

Still not working to the lastest Dio version

rirjkl19 avatar Jun 01 '21 12:06 rirjkl19

The issue still exists in version 3.0.10

Mohamed-Emara-ADV avatar Jun 07 '21 10:06 Mohamed-Emara-ADV