mapbox / mapbox/mapbox-java

RetryAndFollowUpInterceptor - java.io.IOException: Canceled

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

还没有人认领这个 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 {
override fun onResponse(
call: Call,
response: Response
) {
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, 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`

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 buildDirectionsApiClient 和报告中所示的 enqueueCall 回调开始,然后跟踪 Mapbox Directions SDK 如何使用 Retrofit 和 OkHttp 处理取消。重现间歇性出现的 IOException: Canceled 情况,并确定该调用是被客户端生命周期取消的,还是被并发请求取消的。确定取消原因,并通过可复现的案例或已确认的 SDK 缺陷进行记录,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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