Negative or huge Retry-After makes the retry sleep throw IllegalArgumentException
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza con getRetryAfterSecondsOrNull en httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/B2WebApiHttpClientImpl.java, luego con B2DefaultRetryPolicy.java y B2Sleeper.sleepSeconds en core/src/main/java/com/backblaze/b2/client/. Reproduce el problema con una prueba unitaria que haga que B2Retryer.doRetry reciba una excepción reintentable y que getRetryAfterSecondsOrNull devuelva -1 o 2200000. Está terminado cuando los valores de Retry-After fuera de rango se acoten o se rechacen, y la espera ya no lance IllegalArgumentException.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
The Retry-After header is parsed with Integer.parseInt and returned unchanged as the wait time. B2Sleeper.sleepSeconds then computes seconds * 1000 as an int, which is negative for a negative header and overflows for values above about 2.1 million seconds, and Thread.sleep throws an unchecked IllegalArgumentException. The exception escapes the retry loop, although the code comment in B2Retryer says the sleep "won't throw".
Where
httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/B2WebApiHttpClientImpl.java:303-314 (getRetryAfterSecondsOrNull), core/src/main/java/com/backblaze/b2/client/B2DefaultRetryPolicy.java:44-52 (returns the server value unchecked), core/src/main/java/com/backblaze/b2/client/B2Sleeper.java:37-38 (seconds * 1000), called from B2Retryer.java (sleeper.sleepSeconds(waitSeconds)).
Why it matters
Impact: Availability (a retryable error turns into an unexpected runtime exception), loud. Severity: High, because it needs a Retry-After value that is negative or over about 2.1 million seconds from the server (unusual, since the HTTP spec allows only non-negative delays), and there is no workaround besides a custom retry policy.
How to check
Found by reading the code, not reproduced. Read the four places above. A unit test could make B2Retryer.doRetry see a retryable exception whose getRetryAfterSecondsOrNull() returns -1 or 2200000 and observe the exception from Thread.sleep. Clamping the value to a sane range in the retry policy or in B2Sleeper would avoid it.
Version
Seen at v6.5.0. Present on the default branch: present.
- Lenguaje dominante
- Java
- Estrellas
- 103
- Forks
- 23
- Merge medio
- 5 d 8 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Backblaze/b2-sdk-java
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Backblaze/b2-sdk-java#248 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Backblaze/b2-sdk-java#247 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Backblaze/b2-sdk-java#246 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Backblaze/b2-sdk-java#245 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Backblaze/b2-sdk-java#242 ·
Los mantenedores suelen responder en 3 días
Todos los issues de Backblaze/b2-sdk-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
IETF-Hackathon/pqc-certificates#351 ·
Los mantenedores suelen responder en 2 días
-
bug(core): skip_nodes.json is missing SELECT and PRE, causing Python and Java to insert separators into dropdown options and preformatted textPosiblemente ocupada @Bhumit267 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
ExceptionThrowShouldUseContext: NullPointerException on a catch block inside an annotation typePosiblemente ocupada @Carbon14-48 la tomó hoy. Abiertoapproved
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
checkstyle/checkstyle#22784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día