Windows: Docker API ignores Connection: close, so a body-less 204 (container start) hangs Testcontainers for .NET

Aperta
#225 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, rust

Direzione di ricerca

Start by tracing how Kiri handles Docker Engine API requests over named pipes and how it writes HTTP responses for container start. Check whether the server honors the request's Connection: close header after sending a body-less 204 response. Reproduce with the PowerShell request in the issue; done when the client receives EOF after the 204.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Kiri version and system

Kiri 0.2.0 on Windows 11 Pro 10.0.26200 (x64), Docker API over \\.\pipe\kiri (also reached through \\.\pipe\docker_engine).

What you did

Sent Docker Engine API requests with the header Connection: close over the named pipe, as Docker.DotNet does on every request (it is the client under Testcontainers for .NET 4.11). Minimal repro in PowerShell, no Docker client involved:

$p = [IO.Pipes.NamedPipeClientStream]::new('.', 'kiri', [IO.Pipes.PipeDirection]::InOut); $p.Connect(3000)
$req = "POST /containers/<id>/start HTTP/1.1`r`nHost: docker`r`nConnection: close`r`nContent-Length: 0`r`n`r`n"
$b = [Text.Encoding]::ASCII.GetBytes($req); $p.Write($b, 0, $b.Length); $p.Flush()
# read until EOF, with a 5 s timeout

(<id> from a plain POST /containers/create with {"Image":"alpine:3.20","Cmd":["sleep","30"]}.)

What happened

Kiri answers, but never closes the connection. After 5 s the pipe is still open with no EOF:

HTTP/1.1 204 No Content
Api-Version: 1.47
Docker-Experimental: false
Ostype: linux
Server: Kiri/0.2.0 (linux)

The 204 carries neither Connection: close nor Content-Length. The 201 from create also stays open after its body; clients cope there because it carries a body length, but a body-less 204 leaves them waiting for the end of the response.

Effect: Testcontainers for .NET hangs forever right after POST /containers/{id}/start returns 204 (Docker.DotNet waits for the connection to end before it completes the response). A test run sat 16 minutes with no further API call.

What you expected instead

What dockerd does: when the request says Connection: close, the server closes the connection after sending the response (RFC 9112 §9.6), so the client sees EOF right after the 204.

Anything else
  • Happens every time.
  • Workaround: a small named-pipe relay in front of \\.\pipe\kiri that closes the client connection after a 204/304 response, with docker.host=npipe://./pipe/<relay> in ~/.testcontainers.properties. With that (plus rewriting "Cmd":[] to null, which is the separate #121 / #222 problem: Ryuk fails with 400 no command specified, and mcr.microsoft.com/mssql/server runs its entrypoint with no arguments and exits), Testcontainers for .NET with Ryuk enabled and SQL Server works on Kiri.
  • Related: #121, #222.
Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
7h 48m
PR unite (30g)
105

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.