FileSystem.downloadAsync/FileSystem.createDownloadResumable.downloadAsync doesn't close requests on Android/Snack
See original GitHub issueEnvironment
Expo CLI 2.3.12 environment info: System: OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver) Shell: 4.4.19 - /bin/bash Binaries: Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm npmPackages: expo: ^31.0.2 => 31.0.2 react: 16.5.0 => 16.5.0 react-native: https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz => 0.57.1 npmGlobalPackages: expo-cli: 2.3.12
Steps to Reproduce
On Android and in Snack, requests made using FileSystem.downloadAsync aren’t closed when the download is complete and hang around. If the remote server then blocks requests because too many are open, the app red screens in native code, or crashes with no information (only observed on Android).
- Setup to download multiple files from a remote server, can be multiple simultaneous or sequential downloads
- Watch the requests build on the remote server (e.g., by using
netstat -nputwc
- Wait until the requests eventually close (Snack?) or kill expo (Android).
Expected Behavior
Requests closed when the download is complete.
Actual Behavior
On Android (OnePlus 6) multiple requests were left open in the TIME_WAIT status (netstat), on iPhone (iPhone 6S) the requests are closed properly (no more than a few over the maximum parallel downloads observed).
Image is of output when run on physical Android device.
Reproducible Demo
The demo uses 100 text files with random characters in, split into 5 queues. On iPhone running from expo the number of requests at once will hover around 6-8, but on Android the number of requests is excessive (see above screenshot). https://snack.expo.io/@innershed/YW5kcm
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
I implemented a version with the same function signature but just used axios and Buffer. Still relies on
Expo.FileSystem
for writing to file. This has only been tested with images and audio files, though, as that was my use case.I am experiencing the same issue. Application on my android phone / emulator crashes when downloading larger amount of files.