You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 onerror handler is called instead of ontimeout
Description
On Android, the
XMLHttpRequestimplementation is incorrectly triggeringonerrorinstead ofontimeout. Causing timeout error to be handled as generic error.Investigated this and found out that this is caused by the switch from using
connectTimeouttocallTimeoutfor okHttp in #38953.callTimeoutwill throwInterruptedIOExceptioninstead ofSocketTimeoutExceptionbut the timeout error catch logic is never updated after the change.Created #55080 to fix the issue.
Steps to reproduce
new XMLtHttpRequestonerrorandontimeoutevent handlerhttps://httpbin.org/delay/10(this endpoint will return a delayed response in 10 seconds)onerrorhandler is called instead ofontimeoutReact Native Version
0.83.1
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
https://github.com/weihanyau/rn-android-uncaught-timeout
Screenshots and Videos
reproducer-timeout-failed.webm
reproducer-timeout-success.webm