Unable to sync data after a network disconnection
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- android, angular, javascript
調査の方向性
リンクされたサービスの createPouchDB、postPouchDB、syncPouchDB、handlePouchDBError のエントリポイントから始め、指定されたバージョンの PouchDB、Cordova Android、CouchDB で短時間のネットワーク中断を再現します。paused、active、error のログを比較して、live retry がなぜ進行しなくなるのかを特定します;再接続後に同期が再開し、データの移動が続けば完了です。
索引モデルが issue の本文から書いたものです。
説明
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 !
- 主要言語
- JavaScript
- スター
- 17.6k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/pouchdb のほかの issue
-
elemMatch throws TypeError: value is null if array has null element対応中かも @henyanagar が 142 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
521xueweihan/HelloGitHub#4237 ·
-
enhancement localization
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
quarto-dev/quarto-cli#15268 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
oarepo/oarepo-ui#512 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信