-
Notifications
You must be signed in to change notification settings - Fork 25k
Open
Labels
Needs: Triage 🔍Platform: AndroidAndroid applications.Android applications.🌐NetworkingRelated to a networking API.Related to a networking API.
Description
Description
On Android, the XMLHttpRequest implementation is incorrectly triggering onerror instead of ontimeout. Causing timeout error to be handled as generic error.
Investigated this and found out that this is caused by the switch from using connectTimeout to callTimeout for okHttp in #38953. callTimeout will throw InterruptedIOException instead of SocketTimeoutException but the timeout error catch logic is never updated after the change.
Created #55080 to fix the issue.
Steps to reproduce
- Create
new XMLtHttpRequest - Set a timeout, eg. 3 seconds
- Add
onerrorandontimeoutevent handler - Call an endpoint that will surely timeout, eg. using an online http request and response service
https://httpbin.org/delay/10(this endpoint will return a delayed response in 10 seconds) - Notice that the
onerrorhandler is called instead ofontimeout
React Native Version
0.83.1
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.7.2
CPU: (10) arm64 Apple M2 Pro
Memory: 132.50 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.11.1
path: /Users/weihan.yau/.nvm/versions/node/v24.11.1/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 11.6.2
path: /Users/weihan.yau/.nvm/versions/node/v24.11.1/bin/npm
Watchman:
version: 2024.12.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.14.3
path: /Users/weihan.yau/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.1
- iOS 26.1
- macOS 26.1
- tvOS 26.1
- visionOS 26.1
- watchOS 26.1
Android SDK: Not Found
IDEs:
Android Studio: 2025.2 AI-252.27397.103.2522.14617522
Xcode:
version: 26.1/17B55
path: /usr/bin/xcodebuild
Languages:
Java:
version: 21.0.8
path: /Users/weihan.yau/.jenv/shims/javac
Ruby:
version: 2.7.8
path: /Users/weihan.yau/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.2.0
wanted: 19.2.0
react-native:
installed: 0.83.1
wanted: 0.83.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
-
MANDATORY Reproducer
https://github.com/weihanyau/rn-android-uncaught-timeout
Screenshots and Videos
| Current | Expected |
|---|---|
reproducer-timeout-failed.webm |
reproducer-timeout-success.webm |
Metadata
Metadata
Assignees
Labels
Needs: Triage 🔍Platform: AndroidAndroid applications.Android applications.🌐NetworkingRelated to a networking API.Related to a networking API.