Very large update requests trigger failure to sync due to revsDiff failure
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- databases
Línea de trabajo
Comienza por la implementación de api.revsDiff mostrada en la issue y examina cómo JSON.stringify gestiona grandes payloads de diferencias de revisiones que contienen adjuntos. Reproduce el fallo con un batch grande y determina después cómo debería la ruta de la request gestionar el RangeError o reducir el batch. Se considera terminado cuando las update requests grandes ya no dejan de sincronizarse de forma silenciosa o repetida.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 17.6k
- Forks
- 1.5k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/pouchdb
-
elemMatch throws TypeError: value is null if array has null elementPosiblemente ocupada @henyanagar la tomó hace 144 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
unref event is not documentedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Validate database namesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
Todos los issues de apache/pouchdb
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
hugomrdias/playwright-test#753 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
KonstantinStarovoytov/kitden#21 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
guybedford/es-module-shims#556 ·
-
app ernst:4-klein
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NewspeedyNL/PidLane#683 ·
Los mantenedores suelen responder en 1 día