ipc (Windows): a server shutdown discards bytes the client has not read (hostd raw terminals may lose the last output)

Abierto
#529 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
69/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start in the Windows implementation of atlas_core::ipc's Stream::Server::poll_shutdown and inspect how it calls NamedPipeServer::disconnect(). Check the Win32 pipe shutdown behavior and add a bounded wait for the client to read the pending bytes or close. Add a cfg(windows) IPC test where a slow client reads all N bytes before EOF; verify it passes, including the existing broken-pipe EOF handling.

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

Descripción

area: runtime type: bug

What

On Windows, atlas_core::ipc's server end discards data the client has not read yet when it shuts down. Stream::Server::poll_shutdown calls NamedPipeServer::disconnect() (DisconnectNamedPipe), and per the Win32 docs that discards anything still in the pipe buffer unless the server first waits for the client (FlushFileBuffers) or for it to close.

Found while fixing the Windows askpass in #525, where it made the password never arrive (3 tests failed on windows-latest: the helper read nothing).

Where else it can bite

crates/atlas-host/src/server.rs, raw terminal connections (attach_raw loop, around L1470-1483 on main at time of writing): when the PTY ends (rrx closes) the loop breaks and calls w.shutdown().await right after the last write_all. On Windows the last chunk of terminal output before the process exits can be lost for a client that has not read it yet. Not reproduced; found by reading the code.

To check: crates/atlas-desktop/src/ctl.rs:123 and debug.rs:145 write a reply and drop the stream (no explicit shutdown). Whether CloseHandle alone loses unread data was not verified.

Proposed fix

Make the semantics safe in one place instead of at each call site: on Windows, poll_shutdown of a server stream waits until the client has read what was written (or has closed) before disconnecting, with a bound. Test under cfg(windows) in ipc tests: server writes N bytes then shuts down; a slow client still reads all N bytes, then EOF. #525 already maps ERROR_BROKEN_PIPE/ERROR_PIPE_NOT_CONNECTED to EOF on the sync client.

Lenguaje dominante
Rust
Estrellas
3
Forks
1
Merge medio
9 h 51 min
PR fusionados (30 d)
310

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 codeatlasdev/atlas

Todos los issues de codeatlasdev/atlas

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.