[BUG] KVRangeRestorer leaves the restore future uncompleted when startRestore() throws, permanently wedging the range
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- backend, distributed-systems, testing-qa
Direzione di ricerca
Inizia in base-kv/base-kv-store-server/src/main/java/org/apache/bifromq/basekv/store/range/KVRangeRestorer.java, in restoreFrom(), quindi segui i percorsi di errore di startRestore() e messenger.send(). Aggiungi il test di regressione descritto nell’issue: verifica che un errore sincrono di avvio completi il future in modo eccezionale e che ritentare con lo stesso snapshot avvii una nuova sessione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- BiFroMQ
4.0.0/main @ eef5e3af - Module:
base-kv/base-kv-store-server - File:
base-kv/base-kv-store-server/src/main/java/org/apache/bifromq/basekv/store/range/KVRangeRestorer.java(restoreFrom)
Summary
restoreFrom() wraps snapshot-install setup in try { ... } catch (Throwable t) { log.error(...) } and returns the session's doneFuture. If startRestore() (or the subsequent messenger.send()) throws synchronously, the future is never completed — and there is no timeout on this path (unlike the receiver-driven path, which has an idle timeout). Worse, the session stays cached in currentSession: a retry with the same snapshot from the same leader hits the reuse branch and returns the same dead future, so the range is permanently stuck — it never applies anything and never retries.
Snapshot install is mandatory on expansion/rebalance, so any transient synchronous failure here is a hard wedge.
Suggested fix
Complete the future exceptionally in the catch block; the caller observes the failure and a retry starts a fresh session:
} catch (Throwable t) {
log.error("Unexpected error", t);
onDone.completeExceptionally(new KVRangeStoreException("Snapshot restore failed to start", t));
}
Test
New regression test: startRestore throws → the future must be completed exceptionally, and a retry with the same snapshot must start a fresh session (not reuse the dead one). Fails on the unfixed code.
Production validation
A 6-node BifroMQ 4.0.0 cluster (standalone.sh, systemd, mTLS clientAuth=REQUIRE), fronted by a TCP load balancer with 6 backends. Live clients: 3 bridge replicas (MQTT5, $oshare subscribers) and 10 backend service instances (persistent sessions). RocksDB engine, default configuration otherwise.
The fix (plus other changes) was rolled across all six nodes one node at a time (wholesale lib/ replacement, then restart), with a per-node gate (service active, all four ports listening, cluster mesh re-established). Six of six nodes succeeded, zero rollbacks.
Post-deploy checks (all measured after the rollout):
| Check | Result |
|---|---|
| Cluster mesh (inter-node 8898/8899 connections, per node) | 408–417 established on every node |
| Live client connections (3 bridge replicas + 10 backend services over mTLS) | 13/13 reconnected and stable |
| Cross-node delivery end-to-end | publish on one node → bridge (connected elsewhere) consumed it → forwarded (counter 0 → 1) |
| Client-visible protocol smoke | connect / subscribe / publish with QoS 1 all CONNACK 0 / PUBACK 0 |
No wedged range (a range stuck in snapshot restore) was observed before or after the deployment; the fix closes the permanent-wedge path should a synchronous start failure ever occur.
- Lingua principale
- Java
- Stelle
- 805
- Fork
- 99
- Merge medio
- 16h 32m
- PR unite (30g)
- 2
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
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 apache/bifromq
-
[BUG] TopicUtil.isValidTopicFilter accepts "$share/g/" — a shared subscription with an empty filter that can never matchForse già presa @efegokdemir l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
[BUG] UTF8Util.isWellFormed inverts the surrogate-pair check: valid non-BMP characters are rejected, lone surrogates acceptedForse già presa @efegokdemir l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Inbound and outbound packet-size checks differ, so a QoS 1 message just under MaxUserPayloadBytes is accepted but never delivered (blocks a persistent subscriber)Forse di nuovo libera @abhiramaab l’ha presa 26 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di apache/bifromq
Issue simili
-
Component - Build
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
navikt/mock-oauth2-server#1149 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
oracle/graalvm-reachability-metadata#11318 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Stirling-Tools/Stirling-PDF#8709 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
area/config
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
quarkusio/quarkus#57910 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno