Interrupted large file upload loses the interrupt flag and keeps uploading parts

Offen
#235 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
java
Bereich
cloud

Rechercherichtung

Start with the two catch (InterruptedException e) blocks in core/src/main/java/com/backblaze/b2/client/B2LargeFileStorer.java, around lines 285-287 (storeFile) and 336-338 (storeParts), and follow the async chain in storeFileAsync around lines 304-312. Compare them with the handling at B2LargeFileUploader.java line 230, which restores the interrupt flag. Done means the interrupt flag is restored and pending part uploads are cancelled, checked by a test that interrupts a thread while a slow part storer is running.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

What happens

If the calling thread is interrupted while B2LargeFileStorer.storeFile() or storeParts() is waiting on the upload, the method throws a B2LocalException but does not call Thread.currentThread().interrupt() and does not cancel the part uploads. The caller is told the upload failed, while parts (and the final finish step chained to them) can keep running in the executor.

Where

core/src/main/java/com/backblaze/b2/client/B2LargeFileStorer.java:285-287 (storeFile) and :336-338 (storeParts), the catch (InterruptedException e) blocks; the chain that keeps running is storeFileAsync at about :304-312. For comparison, B2LargeFileUploader.java:229-231 does call Thread.currentThread().interrupt() in the same situation.

Why it matters

Impact: Wrong request or result (failure reported while work continues, and the interrupt flag is lost without any message). Severity: High, because it only happens when a thread is interrupted during a large upload (unusual), and there is no workaround: a caller cannot tell whether the file was later finished.

How to check

Found by reading the code, not reproduced. Read the two catch blocks and compare them with B2LargeFileUploader at line 230. A test could start storeFile with a slow part storer, interrupt the thread, and check Thread.currentThread().isInterrupted() and whether the part storers are still running.

Version

Seen at v6.5.0. Present on the default branch: present.

Vorherrschende Sprache
Java
Sterne
103
Forks
23
Ø Merge
5 T. 8 Std.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Backblaze/b2-sdk-java

Alle Issues in Backblaze/b2-sdk-java

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

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