RetryAndFollowUpInterceptor - java.io.IOException: Canceled
- Dominant language
- Java
- Stars
- 438
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
## 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`
Contributor guide
Research direction
Start with buildDirectionsApiClient and the enqueueCall callback shown in the report, then trace how the Mapbox Directions SDK uses Retrofit and OkHttp around cancellation. Reproduce the intermittent IOException: Canceled case and determine whether the call is being canceled by the client lifecycle or concurrent requests. Done means the cancellation cause is identified and documented with a reproducible case or a confirmed SDK defect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- api, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100