dio icon indicating copy to clipboard operation
dio copied to clipboard

Isolate hangs when responding to large json

Open amd110 opened this issue 3 months ago • 3 comments

Package

dio

Version

5.8.0+1

Operating-System

Android

Adapter

Default Dio

Output of flutter doctor -v

Flutter (Channel stable, 3.35.1, on macOS 15.5 24F74 darwin-arm64, locale zh-Hans-MO) [337ms]
    • Flutter version 3.35.1 on channel stable at /Users/xxx/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (5 weeks ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: no-enable-web, no-enable-linux-desktop, no-enable-macos-desktop, no-enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

Dart Version

3.9.0

Steps to Reproduce

1.open app
2.Mobile lock screen
3.Wait a moment,Unlock screen,send a dio request with response body size Larger, The specific threshold is unclear ,and response type is json,content-type is json 4.this dio request no result,

Expected Result

over the receiveTimeount should be return

I found ,the lock screen caused "Lost Device",then back app use isolate will hang. I don't have this problem when I use the official dart http library

Actual Result

No results

amd110 avatar Sep 16 '25 01:09 amd110

Subsequent large response requests have no results unless the App is restarted

amd110 avatar Sep 16 '25 01:09 amd110

me too

zhangzhen-inagora avatar Sep 17 '25 05:09 zhangzhen-inagora

我找到原因了,是因为小json会消耗更多资源,下面的方案解决了我的问题

Image

zhangzhen-inagora avatar Oct 11 '25 02:10 zhangzhen-inagora