Support for graceful shutdown

Abierto
#287 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
32/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c, r
Área
networking

Línea de trabajo

Start with the httpuv server object and its connections callback, then review how server behavior is exposed at the R level. Trace the existing listener, HTTP, and WebSocket lifecycle before deciding where a shutdown state belongs. Done means existing connections can finish while new connections are rejected, with a usable R-level shutdown entry point.

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

Descripción

My motivation here is that to have some sort of graceful transition during Shiny deployments so that existing users don't immediately greyscreen. By this I mean that existing websocket/HTTP connections should continue to work but new connections cannot be made to the running server.

As an external example, the HTTP server from the Go standard library can be put into "shutdown" mode:

Shutdown works by first closing all open listeners, then closing all idle connections, and then waiting indefinitely for connections to return to idle and then shut down.

Which sounds like the right approach to me. Waiting indefinitely is fine for our usecase, since SIGKILL can be used to terminate the process eventually if it exceeds some timeout. (This is how Kubernetes works by default.)

There is an upstream issue on libuv for a direct "stop listening" API that links to various supporting discussions, but it has not been implemented.

The libuv thread above suggests emulating "stop listening" support by having the connections callback just call uv_close() right after calling uv_accept() (as simply not calling uv_accept will accumulate connections in the kernel). I believe httpuv could do when a "shutdown" flag has been set on the server object, although I'm not sure how this ought to be exposed at the R level.

This is mildly related to #226.

Lenguaje dominante
C
Estrellas
252
Forks
87
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rstudio/httpuv

Todos los issues de rstudio/httpuv

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.