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

DioException [DioExceptionType.receiveTimeout] not working #1868

Closed
Apichate-Y opened this issue Jun 15, 2023 · 13 comments
Closed

DioException [DioExceptionType.receiveTimeout] not working #1868

Apichate-Y opened this issue Jun 15, 2023 · 13 comments

Comments

@Apichate-Y
Copy link

Package

dio

Version

5.2.0

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.7.12, on macOS 13.4 22F66 darwin-arm64, locale en-TH)
    • Flutter version 3.7.12 on channel stable at /Users/apichete/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (8 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/apichete/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2022.1)
    • 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 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 68.1.4
    • Dart plugin version 221.5787.37

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.106

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Dart Version

2.19.6

Steps to Reproduce

No

Expected Result

I set the duration but it doesn't work. The previous version is not

Actual Result

Screenshot 2566-06-15 at 17 19 07
@Apichate-Y Apichate-Y added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jun 15, 2023
@AlexV525
Copy link
Member

Thanks for the report. Please fill in information about what device you are using to test, and better to provide a minimal reproducible example.

@Velkamhell97
Copy link

Velkamhell97 commented Jun 15, 2023

I have the same problem, I can't catch these exceptions in a try-catch either. I intentionally programmed a delay in the server, and try to catch this exception but the exception always goes to uncaught exceptions. do you know if i am doing something wrong ?

const express = require('express');
const timeout = 10000;

const app = express();

app.get('/', function (req, res) {
  setTimeout((function() {
    res.send('Hello World')
  }), timeout);  
})

app.listen(8080, () => {}); 
final dio = Dio(
    BaseOptions(  
      baseUrl: 'http://10.0.2.2:8080',
      receiveTimeout: const Duration(seconds: 3),
    )
  );

try {
  final response = await dio.get('/');
  print(response.data);
} on DioException catch(exception) {
  print('dio error: $exception');
} 

This is the relevant StackTrace

#0      DioMixin.request (package:dio/src/dio_mixin.dart:372:36)
#1      DioMixin.get (package:dio/src/dio_mixin.dart:63:12)
#2      LoginNotifier.login (package:products_app/features/auth/presentation/screens/login/login_notifier/login_notifier.dart:28:34)
#3      LoginForm._submit (package:products_app/features/auth/presentation/widgets/login_form.dart:22:10)
#4      LoginForm.build.<anonymous closure> (package:products_app/features/auth/presentation/widgets/login_form.dart:79:32)
#5      LoadingButton.build.<anonymous closure> 

Here is an image where the exception points me

image

@kuhnroyal
Copy link
Member

Is this new with 5.2.0 or something you also experienced before?

@Velkamhell97
Copy link

I did some tests and it happens since version 5.2.0, with version 5.1.2 it works correctly and catches the exception.

@kuhnroyal
Copy link
Member

Then it is probably related to the changes in #1836

@Velkamhell97
Copy link

I hope that can fix this in later versions

@AlexV525
Copy link
Member

I did some tests and it happens since version 5.2.0, with version 5.1.2 it works correctly and catches the exception.

Could you do a git bisect from 5.1.2 to 5.2.0 to find out which commit causes the issue?

@AlexV525
Copy link
Member

@Velkamhell97 I think your problem should be a duplicate of #1869.

@AlexV525
Copy link
Member

@Apichate-Y Can you provide more details?

@AlexV525 AlexV525 added h: need more info Further information is requested and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Jun 20, 2023
@Velkamhell97

This comment was marked as off-topic.

@Velkamhell97
Copy link

What bad thing did I say?

@AlexV525
Copy link
Member

There's no bad thing, you'll need to follow up the issue I've mentioned.

@Apichate-Y
Copy link
Author

@AlexV525 In the new version I got it fixed, thank you.

@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2023
@AlexV525 AlexV525 added i: outdated and removed h: need more info Further information is requested labels Jun 22, 2023
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

4 participants