RetryAndFollowUpInterceptor - java.io.IOException: Canceled
未關閉
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 438
- 分支
- 117
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Issue
Multiple RetryAndFollowUpInterceptor - java.io.IOException: Canceled
Description
We are getting randomly multiple java.io.IOException: Canceled when using the Mapbox Directions SDK. Code snippet is:
SDK used
//Mapbox Directions API
implementation "com.mapbox.mapboxsdk:mapbox-sdk-services:6.13.0"
Code Snippet
for origin = "Point{type=Point, bbox=null, coordinates=[-58.449951171875, -34.55467987060547]}"
for destination = Point{type=Point, bbox=null, coordinates=[-58.484619140625, -34.57625961303711]}
private fun buildDirectionsApiClient(origin: Point, destination: Point): MapboxDirections {
val routeOptions = RouteOptions.builder()
.geometries(DirectionsCriteria.GEOMETRY_POLYLINE6)
.overview(DirectionsCriteria.OVERVIEW_SIMPLIFIED)
.profile(DirectionsCriteria.PROFILE_DRIVING)
.coordinatesList(listOf(origin, destination))
.build()
return MapboxDirections.builder()
.accessToken(accessToken)
.routeOptions(routeOptions)
.build()
}
and the way we are executing the calls is:
client?.enqueueCall(object : Callback<DirectionsResponse> {
override fun onResponse(
call: Call<DirectionsResponse>,
response: Response<DirectionsResponse>
) {
response.body()?.routes()?.firstOrNull()?.let { route ->
mapbox.getStyle {
val source: GeoJsonSource? = it.getSourceAs(ROUTE_SOURCE_ID)
val lineString = LineString.fromPolyline(
route.geometry()!!,
Constants.PRECISION_6
)
// Set the map's camera position taking into account the route drawing
val coordinateList = lineString.coordinates()
animateMarker.setBoundary(coordinateList)
val camera = mapbox.cameraForCoordinates(coordinateList, getPadding())
mapbox.easeTo(camera, source, lineString)
}
}
}
override fun onFailure(call: Call<DirectionsResponse>, t: Throwable) {
DevMetrics.monitor(errorParams("Mapbox cannot draw route points reason is ${t.cause} - ${t.message}"))
onError()
}
})
Not sure if we are doing something wrong because it mostly works and draw the route but randomly it shows us this exception coming from Retrofit and OkHttp
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 buildDirectionsApiClient 和報告中所示的 enqueueCall callback 開始,接著追蹤 Mapbox Directions SDK 如何使用 Retrofit 和 OkHttp 處理取消。重現間歇性出現的 IOException: Canceled 情況,並判斷該呼叫是由 client 生命週期取消,還是由並行請求取消。確認取消原因,並以可重現的案例或已確認的 SDK 缺陷加以記錄,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- android, java
- 領域
- api, mobile-dev
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100