Unable to sync data after a network disconnection
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- android, angular, javascript
- Ambito
- databases, distributed-systems, mobile-dev
Direzione di ricerca
Inizia dagli entry point createPouchDB, postPouchDB, syncPouchDB e handlePouchDBError del servizio collegato, quindi riproduci una breve interruzione di rete con le versioni indicate di PouchDB, Cordova Android e CouchDB. Confronta i log paused, active ed error per determinare perché il live retry smette di fare progressi; il lavoro è completo quando la sincronizzazione riprende e i dati continuano a essere trasferiti dopo la riconnessione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
I've been using pouchdb on tablets using it to syncing data from multiple tablets on a couchdb server. While using my tablets I occasionnally loose internect connection for a few microseconds. In most cases no issues but on few instances the sync seems to not work anymore and i do not get any more data from my tablets.
Info
- Environment: Pouch 7.3.1
- Platform: Cordova Android 11 & Angular 14
- Server: CouchDB 3.3.1 and PouchDB Server
Reproduce
I know the context can be very specific but i'll still link samples of my pouchdb service and some logs i've got spotting this issue. I do send data using the postPouchDB function
Service
public createPouchDB(id: string) {
const nameDB = id + '-' + this.deviceUUID;
const remoteNameDB = id + '-' + this.deviceUUID;
this.localDB = new PouchDB(nameDB);
this.localDB
.createIndex({
index: {
fields: ['id'],
},
})
.then((index_session) => {
this.logService.logDebug('Index : ' + JSON.stringify(id));
})
.catch(function (err) {
this.logService.logError('createIndex error : ' + JSON.stringify(err));
this.handlePouchDBError(err);
});
this.remoteDB = new PouchDB(this.environmentService.environment.urlCouchdb + remoteNameDB, {
auth: {
username: this.environmentService.environment.usernameCouchdb,
password: this.environmentService.environment.passwordCouchdb,
},
});
}
public postPouchDB(answer: Answer) {
this.logService.logInfo(`postPouchDB answer : ${JSON.stringify(answer)}`);
this.localDB.post(answer);
}
public syncPouchDB() {
// this syncs in both directions: from remote and to remote
this.localDB
.sync(this.remoteDB, {
live: true, // continuously sync between local and remote.
retry: true, // Retry on connection lost.
})
.on('paused', (info) => {
// replication was paused, usually because of a lost connection.
this.logService.logDebug('La replication a été mise en pause : ' + JSON.stringify(info));
this.tabletteAnimationLogService.createLog('pause', JSON.stringify(info), 'pouchdb');
})
.on('active', (info) => {
// replication was resumed.
this.logService.logDebug('La replication a été activée : ' + JSON.stringify(info));
})
.on('change', (change) => {
// something did change.
this.logService.logDebug('Il y a eu un changement dans la synchronisation pouchDB : ' + JSON.stringify(change));
})
.on('error', (error) => {
// error happened.
this.logService.logError('Il y a eu une erreur dans la synchronisation pouchDB : ' + JSON.stringify(error));
this.tabletteAnimationLogService.createLog('error', JSON.stringify(error), 'pouchdb');
this.handlePouchDBError(error);
});
}
protected handlePouchDBError(error) {
const pouchDBError = PouchDBErrors.generateErrorFromResponse(error);
this.logService.logError("PouchDBError : " + JSON.stringify(pouchDBError));
}
Logs
2025-01-17 12:28:59.664 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:01.443 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:01.765 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:04.060 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:04.480 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:06.438 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:06.830 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:07.873 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:08.219 : DEBUG : La replication a été mise en pause : undefined
It seems that it trys to sync but soen't succeed and does it again.
Thanks for the help !
- Lingua principale
- JavaScript
- Stelle
- 17.6k
- Fork
- 1.5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la 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/pouchdb
-
elemMatch throws TypeError: value is null if array has null elementForse già presa @henyanagar l’ha presa 144 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Validate database namesAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
Tutte le issue di apache/pouchdb
Issue simili
-
cdx-audit output written to a pipe is cut off at 64 KiBForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug mode:cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Build produces empty forge.min.js: package.json lists "forge" instead of "node-forge"Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Fei2411/DeepSeek-Bot#963 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Miaotofu01/Study-Mate#244 ·
I maintainer di solito rispondono entro 1 giorno
-
test-reliability
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Azure/azure-sdk-for-js#40672 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno