ElementsProject / ElementsProject/elements

elementsd shutdown seems unnecessarily slow for long-running nodes

Abierto
#1,207 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
1.2k
Forks
416
Merge medio
1 d 23 h
PR fusionados (30 d)
15

Descripción

I'm curious if other people are finding that elementsd shutdown takes forever when the node has been running for a very long time, or if this is somehow unique to my machine. It's possible this issue is somehow specific to mac or non-linux platforms; it's also possible it's been made worse by my memory-reducing fix.

What appears to be happening: during shutdown we manually unload the block index, and deallocate the entries, one at a time. This seems basically pointless -- all we're doing is manually freeing memory that will be freed anyway when the process exits. This does not seem to be slow if we've just started, but takes forever when run on a process that's been around for a long time. What I _suspect_ is happening is that the block index has been paged out to disk, and in clearing it we're paging it in, a bit at a time, as we access the entries in random order. Even at SSD speeds, paging in multiple gigabytes using random reads is going to take ages.

(The more problematic possibility is some kind of leak, but I don't see the process having particularly excessive memory usage -- any more than usual -- so I don't think this is it.)

If possible, it would be nice to stop wasting all this effort on shutdown. Assuming it's in fact wasted, one possible catch is the use of the same codepaths in test cases -- we may still need to cleanly delete objects there, if we have to create and destroy multiple block indices before ending the process.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza localizando la ruta de apagado que descarga manualmente el índice de bloques y desasigna sus entradas, y compárala después con el comportamiento al salir del proceso. Reproduce, si es posible, un apagado después de un node de larga duración, e inspecciona los casos de prueba que crean y destruyen varios índices de bloques. Se considera terminado cuando se evita trabajo innecesario durante el apagado y se conserva la eliminación limpia allí donde las pruebas la requieren.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.