Very large update requests trigger failure to sync due to revsDiff failure
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 43/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- databases
Direzione di ricerca
Parti dall’implementazione di api.revsDiff mostrata nell’issue ed esamina come JSON.stringify gestisce payload di grandi dimensioni con differenze di revisione contenenti allegati. Riproduci il fallimento con un batch di grandi dimensioni, quindi determina come il percorso della request dovrebbe gestire il RangeError o ridurre il batch. Il lavoro è completato quando le grandi update requests non smettono più di sincronizzarsi in modo silenzioso o ripetuto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I've just diagnosed a problem we were having where sometimes our local pouchDB database did not sync to the remote CouchDB. The source of the problem turned out to be due to our use of a very large batch size (1000) combined with a number of large attachments on documents.
The problem occurs in the implementation of revsDiff:
api.revsDiff = adapterFun('revsDiff', async function (req, opts, callback) {
// If no options were given, set the callback to be the second parameter
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
try {
// Get the missing document/revision IDs
const result = await fetchJSON(genDBUrl(host, '_revs_diff'), {
method: 'POST',
body: JSON.stringify(req)
});
callback(null, result.data);
} catch (error) {
callback(error);
}
});
We were seeing the failure of JSON.stringify with our large payload (RangeError: Invalid string length). This meant that the POST request was not sent. PouchDB then went on to try again with the same payload and failed again.
There is most likely an error reported via the appropriate handler but we missed it.
The solution was to reduce the batch size so that the payload of one request was much smaller.
However, I feel that this is something that could be worked around inside PouchDB - perhaps backing off to smaller batches in the case of a RangeError in this function.
Posting here for reference in case others see this issue and in case this can be prioritised for a fix.
- 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 142 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
-
[vika] console keeps a stale "in progress" turn after a daemon restart mid-runForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
volcengine/OpenViking#7011 ·
I maintainer di solito rispondono entro 1 giorno
-
Issue: ready for confirmation Reported on 2.4.9 Triage: Dev.Experience
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
magento/magento2#41773 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
Upgrade listener stays on a custom server after close when `preClose` is setForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fastify/fastify-websocket#388 ·
-
[推荐] 影夕视频Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
Perl - Readme DriftForse già presa @Omnideth l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
CommunityToolkit/Aspire#2375 ·
I maintainer di solito rispondono entro 2 giorni