List iterators lose an item when loading the next page fails
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia da next() in core/src/main/java/com/backblaze/b2/client/B2ListFilesIterableBase.java (circa righe 43-58), dove currentIndex viene incrementato prima che advanceIfNeeded() possa lanciare un'eccezione; lo stesso schema compare in B2ListPartsIterableBase.java circa alle righe 30-45. Scrivi un test con un client simulato che fallisce al caricamento della seconda pagina, poi richiama next() dopo aver catturato l'eccezione per verificare che l'elemento venga perso. È completato quando l'elemento viene restituito o ritentato correttamente e il test passa, per entrambi gli iteratori.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
In next(), the iterator moves past the current item and then loads the next page if the current page is used up. If that page load fails, B2RuntimeException is thrown from next() and the item that was just taken is not returned. A caller that catches the exception and continues will not see that item, and the next next() call fails with an IllegalStateException instead of retrying the page.
Where
core/src/main/java/com/backblaze/b2/client/B2ListFilesIterableBase.java:43-58 (next() at about :50 increments currentIndex, then calls advanceIfNeeded()); the same pattern is in core/src/main/java/com/backblaze/b2/client/B2ListPartsIterableBase.java:30-45.
Why it matters
Impact: Wrong request or result (a listing silently misses an item for a caller that continues after the error), loud for the failed call. Severity: Medium, because it needs a page load that fails after retries and a caller that catches the error and keeps iterating (unusual), and a caller that stops on the first error is not affected.
How to check
Found by reading the code, not reproduced. Read next(): the value is read and currentIndex incremented before advanceIfNeeded() can throw. A test with a mocked client that fails on the second page load, and a caller that catches the exception and calls next() again, would show the missing item. Advancing lazily in hasNext() or returning the item before advancing would avoid it.
Version
Seen at v6.5.0. Present on the default branch: present.
- Lingua principale
- Java
- Stelle
- 103
- Fork
- 23
- Merge medio
- 5g 8h
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Backblaze/b2-sdk-java
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Backblaze/b2-sdk-java#248 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Backblaze/b2-sdk-java#247 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Backblaze/b2-sdk-java#246 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Backblaze/b2-sdk-java#245 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Backblaze/b2-sdk-java#242 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Backblaze/b2-sdk-java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
IETF-Hackathon/pqc-certificates#351 ·
I maintainer di solito rispondono entro 2 giorni
-
bug(core): skip_nodes.json is missing SELECT and PRE, causing Python and Java to insert separators into dropdown options and preformatted textForse già presa @Bhumit267 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
ExceptionThrowShouldUseContext: NullPointerException on a catch block inside an annotation typeForse già presa @Carbon14-48 l’ha presa oggi. Apertaapproved
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
checkstyle/checkstyle#22784 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno