mapbox / mapbox/mapbox-java

RetryAndFollowUpInterceptor - java.io.IOException: Canceled

Offen
#1,566 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Java
Sterne
438
Forks
117
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit buildDirectionsApiClient und dem im Bericht gezeigten enqueueCall-Callback und verfolge anschließend, wie das Mapbox Directions SDK Retrofit und OkHttp im Zusammenhang mit Abbrüchen verwendet. Reproduziere den sporadisch auftretenden Fall IOException: Canceled und ermittle, ob der Aufruf durch den Lebenszyklus des Clients oder durch nebenläufige Anfragen abgebrochen wird. Die Aufgabe ist erledigt, wenn die Ursache des Abbruchs identifiziert und anhand eines reproduzierbaren Falls oder eines bestätigten SDK-Fehlers dokumentiert wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, java
Bereich
api, mobile-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.