Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetryAndFollowUpInterceptor - java.io.IOException: Canceled #1566

Open
nicolasjafelle opened this issue Oct 12, 2023 · 1 comment
Open

RetryAndFollowUpInterceptor - java.io.IOException: Canceled #1566

nicolasjafelle opened this issue Oct 12, 2023 · 1 comment

Comments

@nicolasjafelle
Copy link

nicolasjafelle commented Oct 12, 2023

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

@jbaris
Copy link

jbaris commented Aug 28, 2024

Any progress on this? We have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants