无网状态下,SDK初始化时会抛出异常,应用捕获不到
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java
- Domain
- api, authentication
Research direction
Reproduce the SDK initialization while offline and trace the call path from AuthenticationInterceptor through JWTOAuth, JWTOAuthClient, and OAuthClient.getAccessToken. Check how the SocketTimeoutException from the OkHttp and RxJava chain propagates during initialization; done means the application can receive and handle the offline failure instead of an uncaught exception.
Written by the indexing model from the issue text.
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)
- Dominant language
- Java
- Stars
- 214
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coze-dev/coze-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
PCMConfig类中缺少关键属性 Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
sdk 和官方文档不一致 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in coze-dev/coze-java
Similar issues
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1156 ·
-
[source-shopify] FAILED bulk operation without partialDataUrl is silently treated as successful Openarea/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100