🐛 Bug Report: App crash on no-internet

未关闭
#72 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
android, kotlin
领域
mobile, networking

调研方向

从 OkHttp 堆栈跟踪所表示的 Android SDK 请求路径开始,在禁用网络的情况下复现,重点关注 UnknownHostException 从异步调用中离开的地方。完成的标准是:失败的请求通过 SDK 的正常错误路径上报,且不会终止应用,并已验证无互联网连接的情况。

由索引模型根据 Issue 内容生成。

描述

bug
👟 Reproduction steps

I'm not able to consistently reproduce this but whenever there is network issues and the SDK tries to make a request it crashes the whole app itself rather than catching the exception

         Fatal Exception: java.net.UnknownHostException: Unable to resolve host "cloud.appwrite.io": No address associated with hostname
               at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
               at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
               at java.net.InetAddress.getAllByName(InetAddress.java:1152)
               at okhttp3.Dns$Companion$DnsSystem.lookup(Dns.kt:1)
               at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:413)
               at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:413)
               at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:413)
               at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:413)
               at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:413)
               at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:60)
               at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.java:60)
               at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:60)
               at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:1)
               at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:156)
               at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:1)
               at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:235)
               at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:1)
               at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:149)
               at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:1)
               at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:100)
               at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:48)
               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
               at java.lang.Thread.run(Thread.java:1012)

### 👍 Expected behavior

Should not crash the app but rather catch the exception

### 👎 Actual Behavior

Crashes the app

### 🎲 Appwrite version

io.appwrite:sdk-for-android:6.0.0

### 💻 Operating system

Android 

### 🧱 Your Environment

_No response_

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)
主要语言
Kotlin
星标
156
派生
29
平均合并
8 小时 49 分钟
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appwrite/sdk-for-android 的其他 Issue

查看 appwrite/sdk-for-android 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。