无网状态下,SDK初始化时会抛出异常,应用捕获不到
- Langage dominant
- Java
- Étoiles
- 214
- Forks
- 98
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
java.net.SocketTimeoutException: failed to connect to api.coze.cn/221.8.93.168 (port 443) from /10.245.3.40 (port 38488) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:236)
at libcore.io.IoBridge.connect(IoBridge.java:180)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:1)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:9)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:16)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:38)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:1)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:7)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:7)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:2)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:27)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:22)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:7)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at com.coze.openapi.service.utils.UserAgentInterceptor.intercept(UserAgentInterceptor.java:6)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:5)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:8)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:5)
at io.reactivex.Observable.subscribe(Observable.java:14)
at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:1)
at io.reactivex.Single.subscribe(Single.java:13)
at io.reactivex.Single.blockingGet(Single.java:2)
at com.coze.openapi.service.auth.OAuthClient.execute(OAuthClient.java:1)
at com.coze.openapi.service.auth.OAuthClient.getAccessToken(OAuthClient.java:5)
at com.coze.openapi.service.auth.JWTOAuthClient.doGetAccessToken(JWTOAuthClient.java:25)
at com.coze.openapi.service.auth.JWTOAuthClient.getAccessToken(JWTOAuthClient.java:13)
at com.coze.openapi.service.auth.JWTOAuth.token(JWTOAuth.java:11)
at com.coze.openapi.service.service.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:5)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:6)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez l’initialisation du SDK hors ligne et suivez le chemin d’appel depuis AuthenticationInterceptor via JWTOAuth, JWTOAuthClient et OAuthClient.getAccessToken. Vérifiez comment la SocketTimeoutException de la chaîne OkHttp et RxJava se propage pendant l’initialisation ; c’est terminé lorsque l’application peut recevoir et gérer l’échec hors ligne au lieu de déclencher une exception non interceptée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- api, authentication
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100